Hi,
I'm trying to post a JSON body using poststring and manually setting the headers of the http post.
When I use jHttp / jHttpUtils2 that I am able to succesfully make the post and get a response which is good.
When I use the exact same code on jOKHttp / jOKhttputils2 I am getting an "Index was outside the bounds of the array." error in the logs.
jHttp ; Version 1.11
jHttpUtils2 : Version 1.03
jOKHttp : Version 1.20
jOKhttputils2 : Version 2.40
I've downloaded the latest version of B4J.
I want to use the jOKhttp including Utils as it is advised to utilize this version.
Next thing is that I need to capture the response cookies. I've found an instruction to update the library for OKhttpUtils2, but it seems that the available sourcecode is not the latest version.
Questions:
1. Why am I getting Index was outside the bounds of the array issue when using jOKhttp and utils2 with the exact same code. Is this a bug?
2. Can someone direct me the absolute latest source code of the OK libraries so I can update to capture the response headers.
I've attached the projects using both versions to show the difference.
JHTTP log (GOOD RESPONSE!) Job.sucess = true
JOKHTTP log: (ERROR RESPONSE HANDLING). Job.sucess = false
I'm trying to post a JSON body using poststring and manually setting the headers of the http post.
When I use jHttp / jHttpUtils2 that I am able to succesfully make the post and get a response which is good.
When I use the exact same code on jOKHttp / jOKhttputils2 I am getting an "Index was outside the bounds of the array." error in the logs.
jHttp ; Version 1.11
jHttpUtils2 : Version 1.03
jOKHttp : Version 1.20
jOKhttputils2 : Version 2.40
I've downloaded the latest version of B4J.
I want to use the jOKhttp including Utils as it is advised to utilize this version.
Next thing is that I need to capture the response cookies. I've found an instruction to update the library for OKhttpUtils2, but it seems that the available sourcecode is not the latest version.
Questions:
1. Why am I getting Index was outside the bounds of the array issue when using jOKhttp and utils2 with the exact same code. Is this a bug?
2. Can someone direct me the absolute latest source code of the OK libraries so I can update to capture the response headers.
I've attached the projects using both versions to show the difference.
B4X:
Sub Submit_Action
Dim j As HttpJob
j.Initialize("downloadFile",Me )
j.PostString("http://comicspriceguide.com/services/siteSearch.asmx/returnTitleSearch","{'sec':{'hs':'27m56uzkeCd2JL//EXWIxyYRV7fkQf9aBzwv6HIpK7k=','ts':'leBEam8WunoHO37PaGhgJAnnxTslcY/XWTroHKA2Cm8='},'filter':{'titleSearch':'walking dead','issueNu':'','country':'MirOu88YWYXjov%2bGDAjeSw%3d%3d','orderType':'pop','searchType':'allwords','searchTabs':'titles','page':1,'per_page':50,'direction':'asc','column':''},'config':{'uid':'G4/NHo2Wlu/T/8lOwpGVEg==','sec':'RBf68jNcrhE8xM50fCudcQ==','schk':['titleSearch','issueNu'],'rarr':['searchType','searchTabs']}}")
j.GetRequest.SetHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0")
j.GetRequest.Setheader("Referer", "http://comicspriceguide.com/comic-book-search")
j.GetRequest.SetHeader("Origin", "http://comicspriceguide.com")
j.GetRequest.SetHeader("Content-Type", "application/json; charset=UTF-8")
j.GetRequest.SetHeader("Accept", "application/json, text/javascript, */*; q=0.01")
j.GetRequest.SetHeader("Accept-Encoding", "gzip, deflate")
j.GetRequest.SetHeader("Accept-Language", "nl-NL,nl;q=0.8,en-US;q=0.6,en;q=0.4")
j.GetRequest.SetHeader("Cookie","cpgCheck=; ")
End Sub
Sub JobDone(job As HttpJob)
Log(job.Tag)
If job.Success Then
Log(job.JobName & " - " & job.GetString)
' Dim m As Map = job.ResponseHeaders
'
' For i = 0 To m.Size - 1
' Dim Key, Value As String
' Key = m.GetKeyAt(i)
' Value = m.GetValueAt(i)
' Log(job.JobName & " - Key:" & Key & ":Value" & Value)
' Next
End If
job.Release
End Sub
JHTTP log (GOOD RESPONSE!) Job.sucess = true
B4X:
Waiting for debugger to connect...
Program started.
java.lang.Object@17a1c670
downloadFile - {"d":{"code":-1,"error":["\u003cdiv class=\u0027clearfix\u0027\u003e\u003ci class=\u0027icon-warning-sign icon-3x pull-left marginleft\u0027\u003e\u003c/i\u003e Your session has expired. Please \u003ca href=\u0027/login\u0027\u003esign in\u003c/a\u003e again to continue.\u003c/div\u003e"],"refresh":true,"page":0,"pages":0,"perPage":0,"total":0,"status":"ERR","loggedin":0}}
java.lang.Object@20c7fa81
downloadFile - {"d":{"code":-1,"error":["\u003cdiv class=\u0027clearfix\u0027\u003e\u003ci class=\u0027icon-warning-sign icon-3x pull-left marginleft\u0027\u003e\u003c/i\u003e Your session has expired. Please \u003ca href=\u0027/login\u0027\u003esign in\u003c/a\u003e again to continue.\u003c/div\u003e"],"refresh":true,"page":0,"pages":0,"perPage":0,"total":0,"status":"ERR","loggedin":0}}
JOKHTTP log: (ERROR RESPONSE HANDLING). Job.sucess = false
B4X:
Waiting for debugger to connect...
Program started.
Index was outside the bounds of the array.
java.lang.Object@3ae1ba41
Attachments
Last edited: