cancel
Showing results for 
Search instead for 
Did you mean: 

Catch soap faults

Former Member
0 Kudos

I have the following scenario: SAP ABAP proxy --> XI --> IIS web service. The IIS web service is not in my hand.

At some request the server has internal server errors. In that case we get SOAP faults from the web service. Now we have the situation that such SOAP faults causes XI mapping errors. But this is not good. I would like to transfer such faults as application faults to the calling ABAP proxy. But I don't know how I can catch these SOAP faults.

Here is the situation in detail.

The response from the IIS web service:

<?xml version="1.0" encoding="utf-8"?>

<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:Server</faultcode>

<faultstring>error description </faultstring>

<faultactor>ws user account</faultactor>

<detail>

<ServerExceptions>bla bla bla</ServerExceptions>

</detail>

</soap:Fault>

</soap:Body>

</soap:Envelope>

In XI monitoring I have 3 entries: my call and two error messages.

First error message payload:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- Aufruf eines Adapters -->

<ServerExceptions>blab la bla</ServerExceptions>

Error information:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- Mapping der Response-Message -->

<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="">ServerExceptions</SAP:ApplicationFaultMessage>

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

The second error message has the same payload but a different error part:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

<!-- Mapping der Response-Message -->

<SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIServer</SAP:Category>

<SAP:Code area="MAPPING">NO_MAPPINGPROGRAM_FOUND</SAP:Code>

<SAP:P1>"my mapping program"</SAP:P1>

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText />

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack>Das Interface-Mapping "my mapping program" ist nicht im Laufzeit-Cache vorhanden.</SAP:Stack>

<SAP:Retry>N</SAP:Retry>

</SAP:Error>

Is there any opportunity to catch such SOAP faults or server errors? I would like to map them in the xi fault structure. So the calling ABAP proxy gets the error message. Now I get a XI error and always a mail because I use the alert framework. But this is no XI error and I don't want to get such error messages.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

You need to do the following:

1. Do you have the wsdl from the webservice? You would have one each for request/response. Similarly for the fault message.You would need to use this, as part of the fault message section in your

a. outbound synch interface

b. inbound synch interface

2. You would have to create a message mapping for this fault message.

The source and target message type would be the fault wsdl here.

3. In your interface mapping you would get a request,response and fault tabs (I assume you are doing a synchronous call to the webservice). You need to mention this fault mapping in the fault tab.

Regards,

Smitha.

Former Member
0 Kudos

Hi Smitha.

Yes. I have a WSDL from the external web service but the WSDL doesn't contain any fault definition. But I know the fault structure because I catch such an exception with XML Spy SOAP Proxy. The Exception looks like in my first post.

The problem is that I don't get this exception in my hands. When I use the Message Display Tool of the Runtime Workbench I can only see the <ServerExceptions> node of the exception in my payload. So I only can deal with this. So I have specified a xsd for this.

<?xml version="1.0" encoding="ISO-8859-1"?>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">

<xs:element name="ServerExceptions">

<xs:simpleType>

<xs:restriction base="xs:string" />

</xs:simpleType>

</xs:element>

</xs:schema>

I load this as external definition and add this to my interface as fault type. After that I'm able to catch the exception and I get the content of this node and map this to the fault message of my outbound interface. Unfortunately the content of this node is useless. I need the values of the other nodes.

O course I tried your proposal and add the complete fault type definition to the given wsdl and after that I re-import this new wsdl. But that doesn't change the behaviour described above.

The key point is that I don't get the whole exception.

Former Member
0 Kudos

Hi,

If these is a more detailed version of the fault when tested with xml spy, it means that there is some processing happening at the adapter level, which is removing these tags.

Try running the receiver soap adapter in nosoap mode.

Check the "Donot use soap envelope" checkbox in the adapter, and check the payload that is displayed in the Message display tool after a rerun.

Regards,

Smitha.

Former Member
0 Kudos

I've got this hint already from the SAP support and of course I tried it. But when I choose this option the external web server doesn't understand my request.

But you are right. In my payload I have the whole exception now.

<?xml version="1.0" encoding="utf-8" ?>

- <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>Der gefundene Anforderungsinhaltstyp ist 'application/xml', aber 'text/xml' wurde erwartet.</faultstring>

<detail />

</soap:Fault>

</soap:Body>

</soap:Envelope>

That means request type is 'application/xml', but 'text/xml' was expected.

Checking the "Do not use soap envelope" checkbox doesn't work for me.

Regards

Gil

Former Member
0 Kudos

Hi,

This is not a problem.

All you need to do now is to add the below mentioned details in the module tab of the receiver soap adapter.

Module name: localejbs/AF_Modules/MessageTransformBean

Type: Local Enterprise Bean

Module Key 0

In Module configuration:

Module key:0

Parameter name: Transform.ContentType

ParameterValue:text/xml

Regards,

Smitha.

bhavesh_kantilal
Active Contributor
0 Kudos

Gil and Smitha,

It is also possible to convert the SOAP Content Type inside your mapping program itself if you are using a Java or XSL mapping.

In case you need to explore this option as well, note : 779981

Ofcourse the option given by smitha will work fine, but just in case!

Regards

Bhavesh

Former Member
0 Kudos

> Hi,

>

> This is not a problem.

> All you need to do now is to add the below mentioned

> details in the module tab of the receiver soap

> adapter.

>

> Module name:

> localejbs/AF_Modules/MessageTransformBean

> Type: Local Enterprise Bean

> Module Key 0

>

> In Module configuration:

> Module key:0

> Parameter name: Transform.ContentType

> ParameterValue:text/xml

>

> Regards,

> Smitha.

I've tried your suggestion but get a new error now.

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>

- <!--

Aufruf eines Adapters

-->

- <SAP:Error xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/" SOAP:mustUnderstand="1">

<SAP:Category>XIAdapterFramework</SAP:Category>

<SAP:Code area="MESSAGE">GENERAL</SAP:Code>

<SAP:P1 />

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>com.sap.aii.af.ra.ms.api.DeliveryException: Object not found in lookup of MessageTransformBean.</SAP:AdditionalText>

<SAP:ApplicationFaultMessage namespace="" />

<SAP:Stack />

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

But I thought MessageTransformBean ist a standard module and I haven't to do some extra work.

Former Member
0 Kudos

Hi,

I am not too sure of this.

Are you getting this error, during the request or is it when you are getting a response back?

The MessageTransformBean is a standard module and no extra work needs to be done on this.

Regards,

Smitha.

Message was edited by:

Smitha Rao

Former Member
0 Kudos

I believe the message doesn't leave the XI. I have only one message in the Runtime Workbench und the payload of this message is my request. In the audit protocol I have the following entry:

SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Interner Serverfehler.

Former Member
0 Kudos

Hi,

This means that the request has reached the server but it could not be processed.

If you look at the Message display tool for this request, you would find that, the equest does not contain a soap envelope. (This is due to the donot use soap env checked in the receiver soap adapter).

You would need to create a soap envelope manually (through xsl or other mappings) before sending it out to through the adapter.

Regards,

Smitha.

Former Member
0 Kudos

Sorry, I abandon this attempt. My interfaces are very simple and XI standard mapping is sufficient for that. The structure of the server exception is very simple too. All I need is to get the whole exception in my hands. In my mind the suggested way is like firing at birds with a cannon.

In my eyes the current behaviour I caused by design. But SAP support denied my request and rated it as consulting inquiry. Disappointing.

I have called web services from .NET Projects too and there I've got all the excpetion information.

Thanks for your help.

Former Member
0 Kudos

Thanks for your reply but I don' believe that this is comparable with my scenario. There you have the throwing of the exception in your hand. We've already implemented scenarios like this: soap client --> XI --> ABAP Proxy. In these cases we already use the FAULT structure to send errors back to the calling client.

My question is how I can catch external soap faults and map them to the xi fault structure to avoid xi mapping errors.

Shabarish_Nair
Active Contributor
0 Kudos

yes tht was for async but in the comment section if you look you will find the link /people/sap.user72/blog/2006/01/16/xi-propagation-of-meaningful-error-information-to-soap-client ... it talks about the fault messages in case of a sync scenario.

Former Member
0 Kudos

Yes, I've read this weblog also but it describes how I can deliver xi error messages to a calling external client. We use this mechanism already.

But I want catch error messages from an external server (not XI errors) and deliver them to the calling client proxy. Now I always get a mapping error and so my calling ABAB proxy also gets this xi mapping error and not the original error text.

Former Member
0 Kudos

Hi,

One alternative would be to catch the mapping error in the BPM and then map the data to the fault message of the Proxy.

Regards

Vijaya

Former Member
0 Kudos

Hi Gil,

If your scenario is a synchronous one, you can catch the exception using raise exception class STATEMENT. Define a class inherited from CX_SY_APPLICATION_FAULT and add a raise exception statement type Classname exporting message = message1.

message1 = err->get_text( ).

If you are still unclear, please paste your proxy code here. I will modify it accordingly.

Deno

Former Member
0 Kudos

This is not my problem. Catching the exception in the ABAP code is easy. My problem is getting the original server error and mapping this to the fault structure. After that of course I will read this information from the fault structure in my ABAP proxy code.

Once again I have the situation that I get a XI mapping error because I don' get the expected answer from the web service. Instead I get the fault message posted in my first post. My question is, how can I manage this and how can I avoid these mapping errors.

In xi monitoring an application error is indicated with a red square with a white flash. In my case I have two error messages with a red point.

Former Member
0 Kudos

Is there really no one who has the same problem? Dealing with SOAP fault messages isn't nothing special. I found my situation at Note 856597 - FAQ: XI 3.0 SOAP Adapter. Watch Point 7 first question. I have the third case - soap fault with payload but I don't know how to deal with this. There you can read " will result in an application error message with fault payload" but I get always a xi mapping error.

Former Member
0 Kudos

I've got a hint from the SAP support service and now I'm a step forward.

I have created a XSD definition from my soap fault message. After that I've imported this XSD into my software component version. At the interface definition I've added the type as external message to the fault message type. Then I've created a message mapping for this and now I use this in my interface mapping.

The result is that I get now application errors and not further system errors.

But I have still a problem. In my case the important information is in the soap part. See first post. But only the <ServerExceptions> is in the payload of the message and so I only get this useless information.

I've no idea how I can get the information from the soap part.

Shabarish_Nair
Active Contributor
0 Kudos

ref. the weblog - /people/shabarish.vijayakumar/blog/2006/11/02/fault-message-types--a-demo-part-1

also in the comment section it refers to the situation where in sync. cases you can utilize the fault messages.

I guess those sud help you.