Skip to Content

Fault Response Handling in Sync Interface

Hi Experts,

We are expecting a Fault response as mentioned below, in case of any failure.

Interface is SAP ECC--> SAP PI --> SOAP(Sync)

<soapenv:Body>

<soapenv:Fault>

<Faultcode>Internal Server Error</Faultcode>

<Faultstring>Exception 8240986231</Faultstring>

</soapenv:Fault>

</soapenv:Body>

We are using the standard FaultMessage Structure shown below and XSLT mapping to extract and send to ECC but it is not working and we are getting transformation error when testing in Operation Mapping.

Error:- Transformer exception occurred when executing XSLT FaultMessage (urn:ariba.XXX, -1, 597a66f0-78b0-11e6-) error logs for detailsTransformer exception occurred when executing XSLT FaultMessage

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<xsl:template match="//soapenv:Fault">
<standard>
<faultText>
<xsl:value-of select="faultcode"/>
</faultText>
<faultDetail>
<text>
<xsl:value-of select="faultstring"/>
</text>
</faultDetail>
</standard>
</xsl:template>
</xsl:stylesheet>

I tried with normal one to one graphical mapping as well - there I am getting error related to soapenv prefixes in the fault response.Please suggest.

Thanks,

Nidhi Srivastava

faultstructure.jpg (81.4 kB)
Add a comment
10|10000 characters needed characters exceeded

Related questions

4 Answers

  • Best Answer
    Posted on Apr 09 at 01:56 PM

    The problem here is that the XML response from the web service server is not valid XML.
    I do not know if this is caused by the SAP PO adapter.
    Could you test the web service using SOAP UI?

    If the fault message is sent wrong from the server, there should be a fix on the server.

    The correct Fault message should have a SOAP envelope:

    http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP:Body>
    <SOAP:Fault>
    <faultcode>SOAP:Server</faultcode>
    <faultstring>Server Error</faultstring>
    </SOAP:Fault>
    </SOAP:Body>
    </SOAP:Envelope>

    If this is missing, it won't work.



    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 07 at 01:31 PM

    The elements in your XSLT have different names as in your SOAP message. Element names are case sensitive.

    Have you tested your XSLT with a tool outside SAP PO?

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Apr 07 at 07:58 PM

    You can find many online tools, for example:

    https://www.freeformatter.com/xsl-transformer.html

    I do not really understand: what is your input and your desired output?

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Stefan,

      The request is working fine, i have used addSoapEnvelope XSLT code to the structure as expected by the target.

      The problem is coming in response. Actually, I have followed the below mentioned blog as the faultcode is coming as a response(system error and not application error).

      https://blogs.sap.com/2015/07/29/soap-faults-and-webservice-faults-from-3rd-party-webservices/

      As per the blog, I created the structure as mentioned in the screenshot below

      Problem is the response and fault response coming from the target is in different format and I am unable to deal with the XSLT code.

      In case of normal response - Envelope along with Header & Body is coming.Also, namespace prefix is coming as soap:

      In case of Fault response - Only Body and Fault tag is coming along with the namespace prefix as soapenv:

      The sample structure are attached for reference.

      structure.txt

      I tried forming the XSLT using the link you provided, it was very helpful. But, as I am beginner to XSLT coding am unable to format the correct structure in which both the structures can be handled.

      Let me know if you have any suggestions.

      Thanks,

      Nidhi Srivastava

      structure.txt (638 B)
      mesg.jpg (34.9 kB)
  • Posted on Apr 08 at 09:53 PM

    Hello Nidhi Srivastava,

    I tried both your "structure.txt" XMLs in an offline tool and came up with this:

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
        xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
        xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:soapenv="http://soapenv.sap"
        exclude-result-prefixes="soap xsd xsi soapenv"
        version="1.0">
        <xsl:template match="text()"/>
        
        <xsl:template match="/soap:Envelope/soap:Header/*[namespace-uri()='XXX' and local-name()='Headers']/*[namespace-uri()='XXX' and local-name()='partition']">
            <successPartition>
                <xsl:value-of select="."/>
            </successPartition>
        </xsl:template>
        
        <xsl:template match="soapenv:Body/soapenv:Fault/Faultcode">
            <errorResponse>
                <xsl:value-of select="."/>            
            </errorResponse>
        </xsl:template>
    </xsl:stylesheet>

    If I apply this to your 2 different XMLs I get this:

    success message

    <?xml version="1.0" encoding="UTF-8"?>
    <successPartition>pr</successPartition>

    error message

    <?xml version="1.0" encoding="UTF-8"?>
    <errorResponse>Internal Server Error</errorResponse>
    

    Try it in Stefan Grube's page, it is working.

    I hope that helps,
    Peter

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Nidhi Srivastava,

      When I tested that XML I added this

      xmlns:soapenv="http://soapenv.sap"
      <soapenv:Body xmlns:soapenv="http://soapenv.sap">
          <soapenv:Fault>
              <Faultcode>Internal Server Error</Faultcode>
              <Faultstring>Error Description</Faultstring>
          </soapenv:Fault>
      </soapenv:Body>

      otherwise that XML will always show that error.

      Could you provide the XSD for that ErrorMessages structure? Just click on tab "XSD" in your first screenshot. THanks, Peter

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.