Below is my code for POSTing to an API
This code works perfectly for me in B4i but not in B4A. I get the below runtime error message:
java.lang.RuntimeException: Only Post / Put requests support this method.
The error points to this line: j.GetRequest.SetContentType("text/xml")
What do I need to change? Thanks.
B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.GetRequest.SetContentType("text/xml")
j.PostString(Main.ServerURL,PostString)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
xml_parser.Initialize
xml_parser.Parse(j.GetInputStream, "Parser")
Else
xui.MsgboxAsync("Server Connection Error: " & j.ErrorMessage , "Error")
End If
j.Release
This code works perfectly for me in B4i but not in B4A. I get the below runtime error message:
java.lang.RuntimeException: Only Post / Put requests support this method.
The error points to this line: j.GetRequest.SetContentType("text/xml")
What do I need to change? Thanks.