How to catch SOAP errors

5
Hello, I've got an imported SOAP web service that is working fine. We have recently implemented error handling on the web service side by returning SOAP errors when the web service call fails. In my microflow that calls the web service however I can't access the SOAP error information. All of the SOAP error variables that are available (such as $lastSoapFaultCode) are 'null'. Any ideas why this would be? Below is an example of the SOAP message that I am getting back from the server: Content-Type: text/xml Content-Length: 364 <?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Body><faultcode>INVALID_MONITOR_ID</faultcode> <faultstring>result.size() == 1</faultstring> <faultactor>monitor:getMonitor</faultactor> <detail>cgi/monitor/get_monitor.cpp:60:result.size() == 1</detail> </SOAP-ENV:Body> </SOAP-ENV:Envelope> Thanks!! Update 1: I've changed the format of the SOAP error coming back however I still get the same exception. Here is the format of the SOAP message now: <?xml version="1.0" encoding="utf-8"?> <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> <env:Body> <env:Fault> <env:Code> <env:Value>env:Sender</env:Value> </env:Code> <env:Reason xml:lang="en"> <env:Text>result.size() == 1</env:Text> </env:Reason> <env:Detail>cgi/monitor/get_monitor.cpp:60:result.size() == 1</env:Detail> </env:Fault> </env:Body> </env:Envelope> Update 2: We've figured out the problem. Our SOAP error message didn't follow the SOAP 1.1 standard completely and Mendix is using SOAP 1.1. After adjusting the format of the message to adhere to the standard everything works fine. If you are looking for it here is the URL to exactly how your SOAP error needs to be formatted: http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383507
asked
1 answers
1

If i compare your soap fault against the w3 standard i notice the following:

<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"
              xmlns:m="http://www.example.org/timeouts"
              xmlns:xml="http://www.w3.org/XML/1998/namespace">
 <env:Body>
  <env:Fault>
   <env:Code>
     <env:Value>env:Sender</env:Value>
     <env:Subcode>
      <env:Value>m:MessageTimeout</env:Value>
     </env:Subcode>
   </env:Code>
   <env:Reason>
     <env:Text xml:lang="en">Sender Timeout</env:Text>
   </env:Reason>
   <env:Detail>
     <m:MaxTime>P5M</m:MaxTime>
   </env:Detail>    
  </env:Fault>
 </env:Body>
</env:Envelope>

The body should contain a fault element which contains the details element and the code element.

answered