Android Question When calling local 'ashx' web service, got an error?

Rajesh Gupta

Member
Licensed User
When calling remote 'ashx' web service, it works well but on calling local 'ashx' web service, got an error?
I have added my web service in application pool of local iis.
My code is

Sub Process_Globals
Dim HttpClient1 As OkHttpClient
Public localWebServiceURL As String="http://localhost/UWS1/UWS/UMSServices.ashx"
End Sub

Sub btnLogin_Click

HttpClient1.Initialize("HttpClient1")
Dim request As OkHttpRequest
request.InitializeGet(localWebServiceURL)
request.SetHeader("UserID","uid")
request.SetHeader("Password","pwd")

request.Timeout = 1000000 'set timeout to 1000 seconds
HttpClient1.Execute(request, 1)

End Sub
Sub HttpClient1_ResponseSuccess (Response As OkHttpResponse, TaskId As Int)

Log(Response.GetHeaders.Get("result"))

End Sub

Sub HttpClient1_ResponseError (Reason As String, StatusCode As Int, TaskId As Int)
ToastMessageShow("Error: " & Reason, True)
End Sub


When run this code, get an error
java.lang.Exception: Sub httpclient1_responseerror signature does not match expected signature.

public static anywheresoftware.b4a.pc.RemoteObject b4a.example.main_subs_0._httpclient1_responseerror(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
 

DonManfred

Expert
Licensed User
Longtime User
1. Use code tags when posting code
2. A "Localhost" will point to the device itself. Use the IP-Adress of the Webservice.
3. You should use okhttputils2 instead of a httpclient
 
Last edited:
Upvote 0
Top