SOAP returns internal server error

JDS

Active Member
Licensed User
Longtime User
I'm using the following code to retreive a XML-file from the server
B4X:
Sub Statussen
   Dim requestSoapXML As String
   
   ProgressDialogShow("Ophalen statussen...")
    requestSoapXML = _
            "<?xml version='1.0' encoding='utf-8'?>" & _ 
               "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _
                    "<soap:Body>" & _
                        "<GetStatusDepots xmlns='http://tempuri.org/'>" & _
                            "<iPda>"&Main.uniqueID&"</iPda>" & _
                            "<sWachtwoord>"&Main.wachtwoord&"</sWachtwoord>" & _
                            "</GetStatusDepots>" & _
                    "</soap:Body>" & _
                "</soap:Envelope>"
    Log(requestSoapXML )
    
    cStatussen.InitializePost2(Main.MainUrl, requestSoapXML.GetBytes("UTF8"))
    cStatussen.SetHeader("Content-Type", "text/xml; charset=utf-8")
    cStatussen.SetHeader("SOAPAction", "")
    
    cStatussen.Timeout = 60000 

    
    Webclient.Initialize("cStatussen")
    If Webclient.Execute(cStatussen, 1) = False Then Return
End Sub

In the procedure "cStatussen_ResponseSuccess" i get a correct XML and the program continues. The next step is to retreive another XML-file (same server) with the following:
B4X:
Sub cStatussen_ResponseSuccess (Response As HttpResponse, TaskId As Int)
    Dim sResult As String
   Dim in As InputStream
    
   sResult = Response.GetString("UTF8")
   sResult = Globaal.ExtractXML(sResult, "GetStatusDepots")
   
   If (s.Trim(sResult)<>"") Then
      Parser.Initialize
      If (File.Exists(File.DirInternal, "Statussen.xml")) Then
         File.Delete(File.DirInternal,"Statussen.xml")
      End If
      File.WriteString(File.DirInternal,"Statussen.xml",sResult)
      
      Log("Statussen ophalen succesvol")
      If Globaal.CompleteCom = 1 Then
         Route
      End If
   End If
End Sub

Sub Route
   Dim requestSoapXML As String
   
   ProgressDialogShow("Ophalen route...")
    requestSoapXML = _
            "<?xml version='1.0' encoding='utf-8'?>" & _ 
               "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>" & _
                    "<soap:Body>" & _
                        "<GetRoute4 xmlns='http://tempuri.org/'>" & _
                            "<iPda>"&Main.uniqueID&"</iPda>" & _
                            "<sWachtwoord>"&Main.wachtwoord&"</sWachtwoord>" & _
                            "</GetRoute4>" & _
                    "</soap:Body>" & _
                "</soap:Envelope>"
    Log(requestSoapXML )
    
    cRoute.InitializePost2(Main.MainUrl, requestSoapXML.GetBytes("UTF8"))
    cRoute.SetHeader("Content-Type", "text/xml; charset=utf-8")
    cRoute.SetHeader("SOAPAction", "")
    
    cRoute.Timeout = 60000 

    
    Webclient.Initialize("cRoute")
    If Webclient.Execute(cRoute, 1) = False Then Return
End Sub

The major difference is the function that is called in the soap body (GetStatusDepots vs GetRoute4). Except this time i don't get a "cRoute_ResponseSuccess" but a "cRoute_ResponseError".

Statuscode = 500
Response = anywheresoftware.b4a.http.httpClientWrapper$HttpResponeWrapper@40527e88
Reason = Internal Server Error

Could anyone point me in the right direction?
 
Top