Hi, I have a non UI jar that runs as a service in a linux server, it is listening to incoming conections in port 17185 from an app
the handle event of the handler class should listen incoming data, process that data and write resp back. I have reached that point without problem but now I need that the handle event sends a webservice and, after reading the response of the webservice, write the resp
I don't know how to do it, If I use sleep or wait in tha handle event it writes an empty string as response.
Something like this
Can anyone please give me a hand?
Thanks
the handle event of the handler class should listen incoming data, process that data and write resp back. I have reached that point without problem but now I need that the handle event sends a webservice and, after reading the response of the webservice, write the resp
I don't know how to do it, If I use sleep or wait in tha handle event it writes an empty string as response.
Something like this
B4X:
Sub Handle(req As ServletRequest, resp As ServletResponse)
EnviarWebService(1,resp)
Wait For EnviarWebService_Complete
End Sub
Sub EnviarWebService(intLugar As Int, resp As ServletResponse)
Dim job1 As HttpJob
job1.Initialize("Ingreso ", Me)
job1.PostString ("http://xxx.xxx.xxx.xxx/ws.php?class=WSBase2&method=inserir", XML)
job1.GetRequest.SetContentType(Content)
Wait For (job1) JobDone(job As HttpJob)
If job.Success Then
Select Case intLugar
Case 1
resp.Write("<Codigo>4</Codigo>" & "<Puerta>F</Puerta>")
Case 2
resp.Write("<Codigo>4</Codigo>" & "<Puerta>E</Puerta>")
Case 3
resp.Write("<Codigo>4</Codigo>" & "<Puerta>C</Puerta>")
End Select
Else
resp.Write("<Codigo>3</Codigo>")
End If
job.Release
CallSubDelayed(Me, "EnviarWebService_Complete")
End Sub
Can anyone please give me a hand?
Thanks