B4J Question Cookie and httpjob

victormedranop

Well-Known Member
Licensed User
Longtime User
Hi, i'm connecting to a web service, but have some issue with cookie, how can I get the cookie to
maintain de connection with httpJob.

I know its manage automatic but I need after login to keep connected to the web server.
Thanks,

Victor
 

victormedranop

Well-Known Member
Licensed User
Longtime User
i'm using this function to connect, but how can I read the cookie to the next post.

B4X:
Sub login_utd_service(resp As ServletResponse)
 Dim utd_consume1 As HttpJob
 utd_consume1.Initialize("",Me)
 Dim data As String = $"<?xml version="1.0" encoding="utf-8"?>
 <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
   <Login xmlns="http://tempuri.org/">
   <username>${username}</username>
 <password>${password}</password>
 <accountId>${userid}</accountId>
   </Login>
 </soap:Body>
 </soap:Envelope>"$
 Log(data)
 utd_consume1.PostString("http://x.x.x.x:991/Service14.asmx",data)
 utd_consume1.GetRequest.SetHeader("SOAPAction","http://tempuri.org/Login")
' utd_consume1.GetRequest.SetHeader("cookie",cookie)
 utd_consume1.GetRequest.SetContentType("text/xml; charset=utf-8")
 
 Wait For (utd_consume1) JobDone(utd_consume1 As HttpJob)
 resp.Write(utd_consume1.GetString)
 If utd_consume1.Success Then
 resp.Write(utd_consume1.GetString)
 End If
 utd_consume1.Release
' StopMessageLoop
End Sub
 
Upvote 0
Top