I've got a http download which doesn't respect the "wait for". Am I missing something?
in my main I've the following
B4X:
Log("in MAIN - before callsub")
CallSub(Starter,"GetNewRoute")
Log("in MAIN - after callsub")
In the Starter:
B4X:
Sub GetNewRoute
Dim j As HttpJob
Dim requestSoapXML As String
Dim sChar As String
sChar = "&"
requestSoapXML = "http://192.168.100.124/status/com.wso/GetRoute13/JSON?iPDA="&"1203"&sChar&"sWachtwoord="&"QWIvL05VUTVHTEorNmIxektaWWNGS"&sChar&"sExtra="&""
j.Initialize("",Me)
j.Download(requestSoapXML)
wait for (j) jobdone(j As HttpJob)
If j.Success Then
Log ("succes download")
j.Release
Else
Log ("failed download")
j.Release
End If
End Sub
The log is
"
in MAIN - before callsub
in MAIN - after callsub
succes download
"
Logger verbunden mit: 988ad036525346515630
--------- beginning of crash
--------- beginning of main
--------- beginning of system
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
in MAIN - before callsub
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
succes download
in MAIN - after callsub
** Activity (main) Pause, UserClosed = false **
Sub test
Log("in MAIN - before callsub")
Wait For(CallSub(Starter,"GetNewRoute")) Complete (Result As String)
Log("in MAIN - after callsub")
End Sub
B4X:
Sub GetNewRoute As ResumableSub
Dim j As HttpJob
Dim requestSoapXML As String
Dim sChar As String
Dim result As String = ""
sChar = "&"
requestSoapXML = "https://www.duckduckgo.com"
j.Initialize("",Me)
j.Download(requestSoapXML)
wait for (j) jobdone(j As HttpJob)
If j.Success Then
result = j.GetString
Log ("succes download")
j.Release
Else
Log ("failed download")
j.Release
End If
Return result
End Sub
I think @BillMeyer is saying that it would make people (like you) more likely to help the same person (like @JDS) next time an issue comes up when their (your) help on a current issue is appreciated (via like(s)).