Skip to Content

There are several blogs and discussions about capturing and handling SOAP faults. This blog leverages on these blogs and discussions to provide a solution about how SOAP faults in addition to the web service faults can be captured in SAP PO/PI when invoking a 3rd Party web service.

Requirement: A 3rd party web service returns errors as web service faults and SOAP fault. Web service faults can be handled easily by adding a fault message in the service interface and adding a fault mapping. However SOAP fault messages need to be explicitly captured in PO/PI.

Solution:

     1. In the SOAP receiver communication channel check do no use SOAP envelope. Doing this ensures that the entire SOAP message including Envelope, Body and Fault can be captured in PO/PI.

          Capture.PNG

     2.  Create a simple XSLT mapping for adding the SOAP envelope (since this gets stripped off from the setting in step 1) and use this after the request     mapping so that the request message has the necessary SOAP envelope when the web service is invoked.         

          Capture1.PNG

     3. Create a custom xsd which would have both the fault message and the response message. Sample message in external definition from imported XSD   as below:

          Capture3.PNG

     4. Use the above external message as the response message in the service interfaces and the response mapping.

     5. If there are namespaces in the response message e.g. “WebServiceFault” has a namespace attached to it these can be removed by using the               XMLAnonymizerBean in the receiver SOAP communication channel.

          Capture4.PNG

     6. Also in the receiver SOAP communication channel set the parameter XMBWS.NoSOAPIgnoreStatusCode = true so that the receiver SOAP           adapter ignores the HTTP Status code when “Do not user SOAP envelope” is used.

          Capture5.PNG

     7. When the web service scenario is tested with the above settings, all the fault messages can be captured in PO/PI and you can decide on the           further course of action.

          Note: Since the response and fault will be returned to the response mapping, you can further split this here or customise the mapping based on           specific requirements.

          Sample error message returned by the web service with the above solution:

          Capture6.PNG

          Sample response message returned by the web service with the above solution:

          Capture7.PNG

References:

856597 – FAQ: XI 3.0 / PI 7.0/7.1/7.3 SOAP Adapter

http://scn.sap.com/people/jin.shin/blog/2007/05/21/handling-web-service-soap-fault-responses-in-sap-netweaver-xi

http://scn.sap.com/people/alessandro.guarneri/blog/2011/01/10/soap-fault-in-sap-pi-hijack-it

To report this post you need to login first.

2 Comments

You must be Logged on to comment or reply to a post.

  1. Prabhu S

    Hi Chandra

    I hope this blog will solve my issue but please can you detail the step 3?

     

    My wsdl has a request and response but no fault so in this case do I need to have response and fault as part of the soap response?

     

     

    (0) 

Leave a Reply