cancel
Showing results for 
Search instead for 
Did you mean: 

How to Capture SOAP FaultString ?

Former Member
0 Kudos

Hi Expert,

I have problem to capture SOAP FaultString Response. At the moment i only can get response below :


  <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <!--  Request Message Mapping  --> 
- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">
  <SAP:Category>Application</SAP:Category> 
  <SAP:Code area="UNKNOWN">APPLICATION_ERROR</SAP:Code> 
  <SAP:P1 /> 
  <SAP:P2 /> 
  <SAP:P3 /> 
  <SAP:P4 /> 
  <SAP:AdditionalText>application fault</SAP:AdditionalText> 
  <SAP:ApplicationFaultMessage namespace="">Exception</SAP:ApplicationFaultMessage> 
  <SAP:Stack /> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

The fault details is


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <!--  Inbound Message   --> 
  <Exception>org.apache.axis2.AxisFault: nested exception is: psdi.util.MXApplicationException: BMXAA4129E Data Not Found !
  -----------
  </Exception>

So what i did right now is to create simple external xsd to capture details exception and it is working fine. is that any way to catpure the faultcode and faultstring only instead of detail ?

The original response from SOAPUI as below


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <soapenv:Fault xmlns:axis2ns1="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>axis2ns1:Server</faultcode>
      <faultstring>Record already exists</faultstring>
      <detail>
        <Exception>org.apache.axis2.AxisFault

Please advise how to capture the faultcode and faultstring only ?

Best Regards

FL

Accepted Solutions (1)

Accepted Solutions (1)

Shabarish_Nair
Active Contributor
0 Kudos

is this a synchronous interface?

if so, you can define fault messages in your inbound and outbound interfaces (provide the WSDL fault message as the fault message for your WS interface). Then create a fault to fault mapping and assign it as part of your operation/interface mapping.

Former Member
0 Kudos

Hi,

Thank you for your response,

The interface is a synchronous interface (ABAP-PROXY to external ws provider). I have created customize fault message and set it into inbound and outbound message interface. At the moment i only can capture details exception only.

below is the fault response from third party ws provider.


<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soapenv:Body>
    <soapenv:Fault xmlns:axis2ns1="http://schemas.xmlsoap.org/soap/envelope/">
      <faultcode>axis2ns1:Server</faultcode>
      <faultstring>nested exception is: ApplicationException: XXX - Record already exists for Vendor</faultstring>
      <detail>
        <Exception>org.apache.axis2.AxisFault: nested exception is: Data not found
        </Exception>
      </detail>
    </soapenv:Fault>
  </soapenv:Body>
</soapenv:Envelope>

as per sxmb_moni inbound message payload i am only able to see detail information only. i cannot see faultcode and faultstring


        <Exception>org.apache.axis2.AxisFault: nested exception is: Data not found
        </Exception>

base on that i have decided to create simple external definition to capture the exception as below xsd


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <xsd:element name="Exception" type="xsd:string" minOccurs="0" />
</xsd:schema>

Please advise how to capture the faultcode and faultstring ? is there any others configuration should be done ?

Cheers

FL

Former Member
0 Kudos

Hi,

We have the same scenario and we are using PI 7.11. In order to capture the fault message from the external webservice, I marked the Do Not Use SOAP Envelope and added a parameter XMBWS.NoSOAPIgnoreStatusCode = true for module sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean on my SOAP receiver comm. channel.

This parameter will acknowledge the fault message as a valid response. So, I used Java mapping in order to capture the details on the SOAP fault and perform the appropriate mapping to get the faultcode and faultstring. You may also use the XSLT mapping for your response mapping. I mapped the source fault message and normal response on the source structure of ABAP (with the added node for Exceptions).

I hope this helps.

Regards,

Jenny

Former Member
0 Kudos

Thank You Jenny.

Best Regards

FL

Answers (1)

Answers (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Only Web service provider can send the fault response mesg. You can map the webservice provider external fault XSD to your custom made fault message that has fields only fault code and string. This way you can retrieve fault code and string.