I have a working b4a app that retrieves data from an ASP.Net web service, but it uses the older HttpUtils method. I want to upgrade the code to rather use the newer HttpUtils2 method (with OkHttpClient), but it just refuses to work.
I based my small test program on your HttpUtils2 demo as below, but this keeps failing with the error: Internal Server Error. And yet the app using the older HttpUtils method retrieves the data just fine.
I assume the error is coming from the Web Service, but I don't know what problem it is encountering.
Please help.
I based my small test program on your HttpUtils2 demo as below, but this keeps failing with the error: Internal Server Error. And yet the app using the older HttpUtils method retrieves the data just fine.
I assume the error is coming from the Web Service, but I don't know what problem it is encountering.
Please help.
B4X:
#Region Module Attributes
#FullScreen: False
#IncludeTitle: True
#ApplicationLabel: HttpUtils2http:Test a Web Service
#VersionCode: 1
#VersionName:
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#LibraryVersion: 2.10
#LibraryName: HttpUtils2 (OkHttpClient)
#End Region
'Activity module
Sub Activity_Create(FirstTime As Boolean)
Dim job1 As HttpJob
Dim XML As String
XML = ""
XML = XML & "<?xml version='1.0' encoding='utf-8'?>"
XML = XML & "<soap12:Envelope xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:soap12='http://www.w3.org/2003/05/soap-envelope'>"
XML = XML & "<soap12:Body>"
XML = XML & "<JSONService xmlns='http://gapsoftware.co.za/'>"
XML = XML & "<SearchTable>28b946e6c826b502|MP000001|77|stock</SearchTable>"
XML = XML & "<SQLQuery>select top 5 * from stock order by [code]</SQLQuery>"
XML = XML & "</JSONService>"
XML = XML & "</soap12:Body>"
XML = XML & "</soap12:Envelope>"
XML = XML.Replace("'", Chr(34))
Log("XML >>>>: " & XML)
job1.Initialize("Job1", Me)
job1.PostString("http://cloud.omegaonline.co.za:88/RevService1.asmx",XML)
job1.GetRequest.SetContentType("application/soap+xml")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Log(Job.GetString)
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Last edited: