cancel
Showing results for 
Search instead for 
Did you mean: 

handling Soap Fault Response.

Former Member
0 Kudos

Hi All,

I have a Proxy to SOAP scenario.

While testing from SoapUI --

I am getting response for the valid input and for the invalid input the response is below.

In the scenario through SAP PI , the valid input given from the HTTP client is getting a valid response and the scenario is running fine.

But while checking the negative test, giving the invalid input, it is ending in a System error in PI.

We have to handle this and send the error back to the source system.

FAULT RESPONSE IN SoapUI :

-


<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

<soap:Body>

<soap:Fault>

<faultcode>soap:Client</faultcode>

<faultstring>System.Web.Services.Protocols.SoapException: Server was unable to read request. ---> System.InvalidOperationException: There is an error in XML document (6, 45). ---> System.InvalidOperationException: Instance validation error: 'AD' is not a valid value for Currency.

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_Currency(String s)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read2_ConversionRate()

at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

--- End of inner exception stack trace ---

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

--- End of inner exception stack trace ---

at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</faultstring>

<detail/>

</soap:Fault>

</soap:Body>

</soap:Envelope>

-


*System error message in SAP PI* :

-


<?xml version="1.0" encoding="UTF-8" standalone="yes" ?><!-- Inbound Message --> <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"><SAP:Category>XIAdapterFramework</SAP:Category><SAP:Code area="MESSAGE">GENERAL</SAP:Code><SAP:P1/><SAP:P2/><SAP:P3/><SAP:P4/><SAP:AdditionalText>com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/PARSING/ADAPTER.SOAP_EXCEPTION - soap fault: System.Web.Services.Protocols.SoapException: Server was unable to read request. ---&gt; System.InvalidOperationException: There is an error in XML document (1, 328). ---&gt; System.InvalidOperationException: Instance validation error: 'US' is not a valid value for Currency.

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_Currency(String s)

at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read2_ConversionRate()

at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayOfObjectSerializer.Deserialize(XmlSerializationReader reader)

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

--- End of inner exception stack trace ---

at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)

at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

--- End of inner exception stack trace ---

at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters()

at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()</SAP:AdditionalText><SAP:Stack/><SAP:Retry>M</SAP:Retry></SAP:Error>

-


I want to capture the text in Fault string in the Fault response and send it back to the Source system.

I have referred many blogs but i am unable to do it.

Will java mapping work as this is a response from the Target Webservice and NOT an errorin PI.

Accepted Solutions (1)

Accepted Solutions (1)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Fault response will be used to capture any business validation or exceptions. I see your situation. Here you consume webservice. Whoever host webservice should have response,request and fault message types in WSDL design. Then only when the webservice provider returns fault messages , you can also use data type as fault message to map the webservice fault response to your side and pass it to proxy for use. If you get system error from webservice provider, you cannot capture those mesg using fault message.

Hope that helps.

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

You can try this workaround:

1. In your SOAP receiver CC, check the Do Not Use SOAP Envelope

2. Add XMBWS.NoSOAPIgnoreStatusCode = true as a paramater for module sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean

3. Use Java Mapping to build the request message and parse the response (including the SOAP Fault)

Hope this helps,

Mark

Former Member
0 Kudos

Hi Mark,

Strangely .. the Positive test is also failing...

I have put the parameter you have mentioned.. I am gettting 500 internal server error even for the correct response from the Webservice.

We found that the request is successfully hitting the webservice. We confirmed from the thirdparty. And they said

that they are also sending a proper response. However the response message is failing in MONI with 500 internal

Server error. Also there is no payload.

Applied the below parameter in the module configuration tab to allow the adapter engine pass the error..

XMBWS.NoSOAPIgnoreStatusCode -- true

Now it is successfull in the adapter engine but failing inthe Integration Engine with the same error.

Nothing is coming into PI. There is no payload. In moni as well as in the RWB.

I am using the WSDL given by the third party guys for my response mapping.

Please guide me on how to capture the paylod. Looks like nothing is coming into PI.. Please suggest..

markangelo_dihiansan
Active Contributor
0 Kudos

Hello,

Since the option Do Not Use SOAP Envelope is ticked, have you tried constructing your SOAP Envelope before sending it to the third party?

Regards,

Mark

Former Member
0 Kudos

Hi,

We raised it with SAP and implemented the NOTE#1522630 XI runtime: Payload ignored due to parsing error

All the responses are coming into PI now.

Thank you for the help and suggestions.

However, i am still not able to map the FAULT response.

i have already tried the blog by Jin Shin mentioned by shabarish above.

Yash

0 Kudos

Hello.

If your scenario is ECC -> Proxy -> PI -> SOAP -> WS -> SOAP -> PI -> Proxy -> ECC.

In ESR create a Fault Message Type, and added to your Service Interface (Outboun/Inbound), use a XSLT mapping to take anyway format response, rebuid your proxy ABAP and see your "message fault" on exception tab.

this works for me.

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>

<xsl:template match="/">

<ns0:FMT_ResponseAuth>

<standard>

<faultText>

<xsl:value-of select="//detail"/>

</faultText>

</standard>

</ns0:FMT_ResponseAuth>

</xsl:template>

I hope this help you.

Edited by: KrlosRios on Nov 2, 2011 5:59 PM

Former Member
0 Kudos

I have figured out that the Soap adapter is in the NO SOAP mode. Hence it is not recognizing the FAULT message type.

I have tried handling both the responses in a java map but not working.

One part of the question was answered, so Closing this thread. I will open a fresh thread for the query.

Thanks for the answers.

gopalkrishna_baliga
Participant
0 Kudos

Hi Yashwanth,

   I too have the same issue. Did u get any solution?

   You said that Soap adapter is in the NO SOAP mode.How did you check this?

   Please send the solution if you got it.

Thanks

Gopal

gopalkrishna_baliga
Participant
0 Kudos

Hi Mark,

   You said:

   3. Use Java Mapping to build the request message and parse the response (including the SOAP Fault)

   How to really parse the fault response? Java mapping you mean the Java class (imported archive) or user defined function in graphical mapping?

  DO we have to use the try and catch block in the Java program to capture the exception and create the response message?

  Please explain.  It will be great if you can send any sample code to understand this better.

Thanks

Gopal

Shabarish_Nair
Active Contributor
0 Kudos

add a fault message for your outbound service interface i.e proxy and also in the inbound service interface add the fault message of the webservice.

then create a mapping for the soap fault to the webservice fault and assign this in your operation/interface mapping.

Also refer:

baskar_gopalakrishnan2
Active Contributor
0 Kudos

I thought webservice provider does not send fault message and only sending system errrors. If the webservice provider respond fault mesg as response for the business exceptions then you can create fault mesg on sender side and use wsdl fault message on the target side and map the response. Shabarish is right. Follow the above given link.

Former Member
0 Kudos

Hi All,

thank you for your responses.

I have mentioned the response given by the webservice when I test it from SoapUI in my First post.

Also I have already read that blog Shabarish mentioned. As per the blog, the Details element is not getting populated in the SoapUI response.

so it is erroring out as a system error.

Shabarish,

The WSDL doesnt have a Fault message. they have not provided it . However I tried tweaking the WSDL and added a fault message in the WSDL and imported it again.

Also, I added the fault message as the outbound fault message and did the Fault mapping. It is not working.

So I have come to the conclusion that as this is a System error, it can not be handled , as mentioned by Bhaskar and also mentioned in the BLOG by Jin Shin.

Please let me know if I am right.

Regards,

Yashwanth

Edited by: YashwanthSVK on Oct 18, 2011 2:52 PM