In my program, I make two (and, hopefully, more eventually) web service requests. If I call them sequentially, they work fine. I'd like to run them concurrently to speed up the request/response. But, if I call them concurrently, as in the code below, what happens is that the first one runs twice (the logs on my server confirm that).
- "Http" is my code module.
Does doing this concurrently properly require using the Threading library? (I'm trying to avoid this) If so, any chance there's an example of concurrent Http requests? (I'm still working on understanding the examples in the Threading library zip file)
B4X:
Http.makeHttpRequest(Http.myXmlFunc1(UserID), "myJobName1", Me)
Http.makeHttpRequest(Http.myXmlFunc2(UserID), "myJobName2", Me)
Sub makeHttpRequest(xmlRequestString As String, jobName As String, targ As Object)
Dim outXML As String = xmlRequestString
Dim url As String = "http://www.mylink.com/mywebservices.asmx"
Dim job1 As HttpJob
job1.Initialize(jobName, targ)
job1.PostString(url, outXML)
job1.GetRequest.SetContentType("text/xml")
job1.GetRequest.Timeout = 5000
Log("HTTP job started: " & jobName)
End Sub
- "Http" is my code module.
Does doing this concurrently properly require using the Threading library? (I'm trying to avoid this) If so, any chance there's an example of concurrent Http requests? (I'm still working on understanding the examples in the Threading library zip file)
Last edited: