HTTPUtils2 passing XML document body

MotoMusher

Active Member
Licensed User
Longtime User
I am a new user, but love what I see so far. :sign0104:

I need to call a 3rd party web service, which states the following:

"To authenticate a user your application will invoke the user service using the HTTP POST method. In order to prevent the username and password from being exposed on the URL, your application will include the following XML in the request body"

So, I created a string
B4X:
UserAuthXMLString = "<?xml version=" & Chr(34) & "1.0" & Chr(34) &"?><api><User><email>"
UserAuthXMLString = UserAuthXMLString & "[email protected]</email><password>"
UserAuthXMLString = UserAuthXMLString & "mypass</password> </User> </api> "


I then call:
B4X:
Dim job2 As HttpJob
   job2.Initialize("Job2", Me)
   job2.PostString("https://someweb.com/api/xxxx/user", UserAuthXMLString)

Is this the correct method to use to send a document body or should I be doing something else? Request is failing and 3rd party verifies email and pass are correct and functioning, so we are down the request itself as the culprit.

Thanks for any help you can provide.
 
Top