Skip to Content
0

SOAP Fault messages - SOAP Reciever

Jun 01, 2017 at 11:10 PM

183

avatar image

Hello

I'm running out of ideas on how to handle the SOAP faults. With the WSDL as in Here, there is not fault message defined

<wsdl:operation name="AnulacionLRDetOperacionIntracomunitaria">
<wsdl:input message="siiWdsl:EntradaAnulacionLRDetOperacionIntracomunitaria"/>
<wsdl:output message="siiWdsl:RespuestaAnulacionLRDetOperacionesIntracomunitarias"/>
</wsdl:operation>

The web service returns a SOAP fault for appication/data errors. Given the above definition, i'm not sure on how to handle the SOAP faults. Did try with couple of blogs from Jin Shin and others but i think that didnt help much.

Appreciate if i can get any help to get this done please.

The scenario i'm working is proxy to soap

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Best Answer
Iñaki Vila Jun 05, 2017 at 06:29 AM
0

Hi Prabhu,

If you give us some example we can help you better, for example with this example i unwrap map the fault messages:

<xsl:stylesheet version="1.0">
    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
    <xsl:template match="/">
        <ns0:RootElement xmlns:ns0="rootnamespace">
            <xsl:choose>
                <xsl:when test=".//faultcode">
                    <ns0:errorData>
                        <ns0:faultcode>
                            <xsl:value-of select=".//faultcode"/>
                        </ns0:faultcode>
                        <ns0:faultstring>
                            <xsl:value-of select=".//faultstring"/>
                        </ns0:faultstring>
                    </ns0:errorData>
                </xsl:when>
                <xsl:otherwise>
                    <ns0:okData>
                        <ns0:elementFirst>
                            <xsl:value-of select=".//n0:elementFirst"/>
                        </ns0:elementFirst>
                    </ns0:okData>
                </xsl:otherwise>
            </xsl:choose>
        </ns0:RootElement>
    </xsl:template>
</xsl:stylesheet>


Regards.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks. I had approached a similiar sol and it works.

0
Iñaki Vila Jun 02, 2017 at 06:03 AM
0

Hi Prabhu,

When i have scenario with SOAP fault and i need a map to sender, i usually follow this steps:

1. On SOAP receiver i mark the check DO NOT USE SOAP ENVELOPE.

2. I do the SOAP envelope manually with XSLT, for the request.

3. I extract with XSLT the response, in this way in one XSLT i unwrap the SOAP tags and prepare for a second mapping the SOAP fault or the normal response without issues.

Regards.

Show 1 Share
10 |10000 characters needed characters left characters exceeded

Thanks for your response . That's what I have in place for (1) and (2).

But when a fault message is received I think we can have a XSLT to catch the message but the main response structures cardinality is 1...1 which fails as the source element is not found in the response. Only the fault message is provided in case of data/application errors

so how do I need to handle this?

0
Anupam Ghosh Jun 02, 2017 at 10:58 AM
0

Hi Prabhu,

When the system is throwing back SOAP fault then please see the structure of the response.

1. create a data type and message type with exact fault xml message PI is receiving from webservice. Say FaultMT

2. Create a message mapping from FaultMT to Proxy expected response . let it be called FaultMM.

3. Add FaultMM to both Outsound Service interface and Inbound service interface under fault mapping part.

4. Add FaultMM to the operation mapping in the third tab of fault mapping.

Regards

Anupam

Show 5 Share
10 |10000 characters needed characters left characters exceeded

Hi anupam

I did already try this but it is not possible to create a fault message with custom structure and have it assigned to the outbound and inbound interfaces.

0

Hi Prabhu,

Under fault message type please use type as "external message" under service Interface.

Create message type of fault message and export the same as XSD and again import it as "external defination" in Service interface.

Regards

Anupam

0

I did try that exactly before I posted this question. The system is not reading the XSD that I imported....just getting struck here

0

Yes, and as far as I know you won't be able to process system faults with fault messages defined for interfaces. It's done for application faults.

Regards, Evgeniy.

0

Hi ,

Can you post the exact fault message you are getting?

Regards

Anupam

0
Evgeniy Kolmakov Jun 02, 2017 at 01:27 PM
0

Hi Prabhu!

In case of using XSLT transformation in response mapping, actually, there is no need to design any extended structures. You just check in XSLT what element exists in your response message and build response message to sender accordingly.

Regards, Evgeniy.

Show 2 Share
10 |10000 characters needed characters left characters exceeded

yes, I'm trying the XSL program aswell but having some issue in generating the structure...

0

Hi Prabhu!

When you call XSLT transformation against input message no schema validation is performed, so both normal response and SOAP Fault messages can be transformed. You just need to check which kind of element exists in input message: //Your_Response_Message_Type or //soap:Fault

Regards, Evgeniy.

0