Webservices Error 500

jnbarban

Member
Licensed User
Longtime User
Hi, I want to communicate whith a Web services but when i try this :

B4X:
Sub btn_Demander_Click
   
        Dim URL As String
   URL = "http://192.168.74.187/WebServices/Mobiv.asmx"
   request.InitializePost2(URL, "GetClient?NoAdresse=5660569".GetBytes("UTF8"))

   request.Timeout = 10000 
   If HttpClient1.Execute(request, 1) = False Then Return
   ProgressDialogShow("One moment please...")

End Sub


Sub HttpClient1_ResponseSuccess (Response As HttpResponse, TaskId As Int)
    Log("ResponseSuccess")
    ProgressDialogHide
    Dim result As String
    result = Response.GetString("UTF8") 'Convert the response to a string
    Log(result)
    Dim rate As Double
   
    lbl_Reponse.Text= result
   
End Sub

Sub HttpClient1_ResponseError (Reason As String, StatusCode As Int, TaskId As Int)
    Log(Reason)
    Log(StatusCode)
    ProgressDialogHide
    msg = "Error connecting to server."
    If reason <> Null Then msg = msg & CRLF & Reason
    ToastMessageShow (msg, True)
End Sub

I've got this error message :
"Internal server exception" ( error 500).

What i do wrong ?

thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Error code 500 means that the server has encountered some error when processing your request.

Make sure to use Http library v1.10 (or higher) and then you can use the following code to see additional information about the error:
B4X:
[COLOR=#0000FF]Sub [/COLOR][COLOR=#000000]hc_ResponseError (Response [/COLOR][COLOR=#0000FF]As[/COLOR][COLOR=#000000] HttpResponse, Reason [/COLOR][COLOR=#0000FF]As[/COLOR][COLOR=#008B8B] String[/COLOR][COLOR=#000000], StatusCode [/COLOR][COLOR=#0000FF]As [/COLOR][COLOR=#008B8B]Int[/COLOR][COLOR=#000000], TaskId [/COLOR][COLOR=#0000FF]As [/COLOR][COLOR=#008B8B]Int[/COLOR][COLOR=#000000])
    Log([/COLOR][COLOR=#800000]"[/COLOR][COLOR=#800000]Error connecting: [/COLOR][COLOR=#800000]"[/COLOR][COLOR=#000000] & Reason & [/COLOR][COLOR=#800000]"[/COLOR][COLOR=#800000]"[/COLOR][COLOR=#000000] & StatusCode)
    [/COLOR][COLOR=#0000FF]If[/COLOR][COLOR=#000000] Response <> Null [/COLOR][COLOR=#0000FF]Then[/COLOR][COLOR=#000000]
        Log(Response.GetString([/COLOR][COLOR=#800000]"[/COLOR][COLOR=#800000]UTF8[/COLOR][COLOR=#800000]"[/COLOR][COLOR=#000000]))
        Response.Release
    [/COLOR][COLOR=#0000FF]End[/COLOR][COLOR=#0000FF]If[/COLOR][COLOR=#0000FF]
End Sub[/COLOR]
 
Upvote 0

drmover

Member
Licensed User
Longtime User
Same problem

I am having the same problem after few posting too.

Any ideas what should I do?

Thank you,
Elad.
 
Upvote 0

drmover

Member
Licensed User
Longtime User
Thank you... work like a charm.

I see the problem - SQL syntax error.

Erel - thank you very much for helping me overcome this and many other problems - you are the king!
 
Upvote 0
Top