cancel
Showing results for 
Search instead for 
Did you mean: 

How to capture SOAP fault when using "Do not use SOAP envelope" parameter

Former Member
0 Kudos

I have exactly the problem described in this thread

Because this thread is 2 years old and I'm not the thread owner I start a new thread.

My actual problem is that I have to manipulate the header of my request (insert authentication information). That's why I use a solution as Bhavesh explained it here at post 3:

All works fine as long I get regular answers from the web service. But I get problems if I receive a soap fault. This causes a system error at the adapter framework and not an application error. I'm not to handle this with a XSLT Mapping like at the normal case.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Gil,

my solution:

In a similar case I have created my own SOAP response message (XSD as an external definition) instead of using the response message provided by the WSDL.

I have married the "normal" response and the fault response into one message by defining all fields as optional. The envelope and the header is allways the same one.

So I can receive the response and the fault messages with only one target messages.

Cheers,

André

Former Member
0 Kudos

Sounds interesting. I will test it.

Former Member
0 Kudos

Okay I've thought about your suggestion for a while but I have no idea how this can work.

If I would have a mapping problem with the response message I would get an error first at this step. In this case I would find the Payload of the incoming message in sxmb_moni. But in my case I have no payload. So I can't deal with that in any way.

If I look at the error node I found the following error message:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> 
- <!-- 
 Eingangs-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>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/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error</SAP:AdditionalText> 
  <SAP:Stack /> 
  <SAP:Retry>M</SAP:Retry> 
  </SAP:Error>

And I have no payload.

I don't understand how you suggestion can solve this problem.

Additional remark: If I look at the message monitoring of the RWB I found 2 messages (request and response) if the request was successful. If I get a server error I only get one, the request. I can find the error message:

SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error

Adapter Framework caught exception: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error

Delivering the message to the application using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 500 Internal Server Error. Setting message to status failed.

Former Member
0 Kudos

In your case, the error is exception from adapter, this is not normal fault message, it is considered as technical error which suppose to be handled by alerting framework.

SAP Fault message is designed to handle application error, not technical error, please see the definition below

Regards

Liang

=======SAP Definition======

Fault message types are designed for application-specific errors that occur on the inbound side and that are reported back to the sender or persisted in monitoring.

u2022 In the synchronous case, when an application-specific error occurs on the inbound side, instead of sending a response message back to the sender, the application can send a fault message to handle the error.

u2022 The fault message of the application for an asynchronous ABAP server proxy is persisted for monitoring. In the case asynchronous of Java server proxies, the fault message is part of a negative application acknowledgement (see Acknowledgments).

Application-specific means that the application on the inbound side triggers the error itself because, for example, the request message did not contain sufficient information.

Former Member
0 Kudos

Hi Liang.

Sorry but this isn't correct. This is a normal soap exception. We receive such faults from other web services as well. In this specific case the soap fault looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<soapenv:Body>
		<soapenv:Fault>
			<faultcode>soapenv:Server.userException</faultcode>
			<faultstring>ERROR (302): Eintrag in der Datenbank nicht vorhanden.; </faultstring>
			<detail>
				<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">server</ns1:hostname>
			</detail>
		</soapenv:Fault>
	</soapenv:Body>
</soapenv:Envelope>

Normally you can deal with this kind of exception. If you don't use the parameter "Do not use SOAP envelope" you can handle this with a message mapping for the fault types. You can see such fault messages as application errors at the monitoring. But in my case the message didn't reach the mapping step. That's why I can't do anything respectively I have no idea what I can do.

Former Member
0 Kudos

Hi, Gil:

I came cross same situation in the past, and I can not achieve what you want.

This is the limitation of PI, it does not support Fault message handling of SOAP.

Even you can use other SOAP client, you can see the fault message coming back, but PI adapter does not handle it back to Integration engine.

Fault message in PI can be only be used in Inbound Proxy, RFC etc...

Regards

Liang

Former Member
0 Kudos

Hi, Gil:

Just found another thread which is answered by Stefan, SAP PI expert, he mentioned the same.

Liang

Edited by: Liang Ji on May 11, 2010 7:44 PM

Former Member
0 Kudos

Of course it is possible to catch SOAP faults with the PI saop adapter. I've done this several times before. Therefore I have created a matching xsd for the soap fault looking like this:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/" targetNamespace="http://schemas.xmlsoap.org/soap/envelope/" elementFormDefault="qualified">
   <xs:element name="Fault">
      <xs:complexType>
         <xs:sequence>
            <xs:element name="faultcode" type="xs:string" />
            <xs:element name="faultstring" type="xs:string" />
            <xs:element name="faultactor" type="xs:string" />
            <xs:element name="detail">
               <xs:complexType>
                  <xs:sequence>
                     <xs:element name="ServerExceptions" type="xs:string" />
                     <xs:element name="faultstring" type="xs:string" />
                  </xs:sequence>
               </xs:complexType>
            </xs:element>
         </xs:sequence>
      </xs:complexType>
   </xs:element>
</xs:schema>

It depends on the soap exception your soap partner throws. You have to import this xsd and have to assign it to the interface. After that you need a mapping to the fault type of your abap interface.

So it is possible to catch soap faults and provide the exception information to the calling abap proxy. At the message monitor you can see such faults as application error (red square with a white flash) and not as system error (red dot).

I my current case it is working too if I switch off the "Do not use SOAP envelope" option. The problem is that I need it because I have to manipulate the header of my request message. And I've found no other way for doing that.

Former Member
0 Kudos

It is nice to know that fault message can be handled in SOAP adapter, I did not try this normal scenario, I composed the soap header in java mapping, so in SOAP receiver adapter, I have to check "Do not use SOAP envelope" as well, in that case, I can not get any fault message.

This is same situation you are encountering now.

I am suggesting you open a OSS note, to see how SAP response.

Regards and Good Luck.

Liang

Former Member
0 Kudos

Hello,

@ Liang,

In this situation, use "XMBWS.NoSOAPIgnoreStatusCode = true" in the SOAP channel -> module tab -> Module configuration.

Module Key will be "soap".

This will capture the fault message even if you use "Do Not Use SOAP Envelope" option in the channel.

Regards,

Neetesh

Former Member
0 Kudos

> Hello,

>

> @ Liang,

>

> In this situation, use "XMBWS.NoSOAPIgnoreStatusCode = true" in the SOAP channel -> module tab -> Module configuration.

> Module Key will be "soap".

>

> This will capture the fault message even if you use "Do Not Use SOAP Envelope" option in the channel.

>

> Regards,

> Neetesh

Hi Neetesh.

That's the solution! If I set this parameter I get no system errors anymore. In fact I get the soap fault as payload now and I can handle it like André has suggested it.

Thank you Neetesh!

Nevertheless I would prefer a solution where I don't have to use this "Do not use soap envelope" setting. So I still hope that Yza can help me with that soap axis adapter nested header problem. I have started a separate thread therefore some weeks ago.

Former Member
0 Kudos

Hi, Neetesh:

Glad to see you provided the solution. I learned from you. Congrats

Liang

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

We are getting a server level SOAP fault message.This is failing in MONI.We would like to capture this fault message and identify due to which source payload this fault has occured.

Please let us know what are all the parameters in sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean

as XMBWS.NoSOAPIgnoreStatusCode = true XMBWS.Timeout which can be used to capture fault with out errors in MONI.

Meanwhile we will test with XMBWS.NoSOAPIgnoreStatusCode and update.

Thanks in advance,

-


<sap:Error xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1">

<sap:Category>XIAdapter</sap:Category>

<sap:Code area="SOAP">FAULT</sap:Code>

<sap:P1>http://schemas.xmlsoap.org/soap/envelope/</sap:P1>

<sap:P2>Server</sap:P2>

<sap:AdditionalText>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: The root element is missing. at System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Web.Services.Protocols.SoapServerProtocolHelper.GetHelper(SoapServerProtocol protocol) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.Invoke() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() --- End of inner exception stack trace ---</sap:AdditionalText>

</sap:Error>

<sap:System xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1" />

- <sap:HopList xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1">

- <sap:Hop timeStamp="2010-06-05T06:34:21Z" wasRead="false">

<sap:Engine type="AE">af.p06.vp06cs01</sap:Engine>

<sap:Adapter namespace="http://sap.com/xi/XI/System">XIRA</sap:Adapter>

<sap:MessageId>5ff588f0-706c-11df-89aa-00145ec6257e</sap:MessageId>

Former Member
0 Kudos

Hi,

We are getting a server level SOAP fault message.This is failing in MONI.We would like to capture this fault message and identify due to which source payload this fault has occured.

Please let us know what are all the parameters in sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean

as XMBWS.NoSOAPIgnoreStatusCode = true XMBWS.Timeout which can be used to capture fault with out errors in MONI.

Meanwhile we will test with XMBWS.NoSOAPIgnoreStatusCode and update.

Thanks in advance,

<sap:Error xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1">

<sap:Category>XIAdapter</sap:Category>

<sap:Code area="SOAP">FAULT</sap:Code>

<sap:P1>http://schemas.xmlsoap.org/soap/envelope/</sap:P1>

<sap:P2>Server</sap:P2>

<sap:AdditionalText>System.Web.Services.Protocols.SoapException: Server was unable to process request. ---> System.Xml.XmlException: The root element is missing. at System.Xml.XmlTextReader.Read() at System.Xml.XmlReader.MoveToContent() at System.Web.Services.Protocols.SoapServerProtocolHelper.GetHelper(SoapServerProtocol protocol) at System.Web.Services.Protocols.SoapServerProtocol.ReadParameters() at System.Web.Services.Protocols.WebServiceHandler.Invoke() at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest() --- End of inner exception stack trace ---</sap:AdditionalText>

</sap:Error>

<sap:System xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1" />

- <sap:HopList xmlns:sap="http://sap.com/xi/XI/Message/30" SOAP:mustUnderstand="1">

- <sap:Hop timeStamp="2010-06-05T06:34:21Z" wasRead="false">

<sap:Engine type="AE">af.p06.vp06cs01</sap:Engine>

<sap:Adapter namespace="http://sap.com/xi/XI/System">XIRA</sap:Adapter>

<sap:MessageId>5ff588f0-706c-11df-89aa-00145ec6257e</sap:MessageId>

Former Member
0 Kudos

Hi,

If you are not calling a REST based non-SOAP service, you shouldn't be using the "do not use soap envelope" mode.

As its name implies, this option is apparently for calling some non-soap services that do not require the soap envelope. So, your requirement of being able to handle the soap faults contradicts its use case.

If you are calling a soap based service that requires some static or variable soap headers, you can use the axis adapter. Without any code development, you can insert or extract arbitrary soap headers in your soap envelope.

Regards, Yza

Former Member
0 Kudos

>

> Hi,

> If you are not calling a REST based non-SOAP service, you shouldn't be using the "do not use soap envelope" mode.

> As its name implies, this option is apparently for calling some non-soap services that do not require the soap envelope. So, your requirement of being able to handle the soap faults contradicts its use case.

>

> If you are calling a soap based service that requires some static or variable soap headers, you can use the axis adapter. Without any code development, you can insert or extract arbitrary soap headers in your soap envelope.

>

> Regards, Yza

Hi Yza.

Thank you for your replay and your hint. This is exactly what I have tried at first. But I wasn't able to get it working. If you could help me in this case it would solve my problems with the soap faults too respectively I would prefer such a solution.

What I need is a header looking like this:

	<SOAP-ENV:Header>
		<m:AuthenticationInfo xmlns:m="urn:Wsvc_Sap_CiList">
			<m:userName>String</m:userName>
			<m:password>String</m:password>
		</m:AuthenticationInfo>
	</SOAP-ENV:Header>

But I wasn't able to generate such a nested header with the axis adapter. I've read the soap axis adapter faq and I was able to create a simple headers like this:

	<SOAP-ENV:Header>
		<m:AuthenticationInfo xmlns:m="urn:Wsvc_Sap_CiList">String</m:AuthenticationInfo>
	</SOAP-ENV:Header>

But I have no idea how I get these nested headers.

In my case the user and password can be static u2013 no need to be dynamic.

It would be so good if you can help me in this case.

Former Member
0 Kudos

Hi Gil,

I am sorry for not being able to reply earlier.

I just replied to your other thread that you were referring to from this thread.

To solve your problem, you need to use just the value property and not the name and namespace properties so that the value property is interpreted as the whole element.

If you set the name and namespace properties, the value property will be interpreted as the character content of that element.

For example, setting value.1 to

<m:AuthenticationInfo xmlns:m="urn:Wsvc_Sap_CiList">

<m:userName></m:userName><m:password></m:password></m:AuthenticationInfo>

will allow you to replace the user and password values dynamically with the context values set in arguments.1.

A similar scenario is described in the axis adapter FAQ note.

Regards, Yza