cancel
Showing results for 
Search instead for 
Did you mean: 

Soap fault message handling in XI

Former Member
0 Kudos

Hi,

I am using axis 1.4. SAP XI is my clinet. My wsdl file as below

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

<wsdl:definitions targetNamespace="http://ws.example.com/service"

xmlns:wns="http://ws.example.com/service"

xmlns:tns="http://ws.exampleenterprise.com"

xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>

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

targetNamespace="http://ws.exampleenterprise.com"

elementFormDefault="qualified">

<xs:complexType name="SecrtySbj">

<xs:sequence>

<xs:element name="usrname" type="xs:string"/>

<xs:element name="pswrd" type="xs:string"/>

</xs:sequence>

</xs:complexType>

<xs:complexType name="AuthenticateRequest">

<xs:sequence>

<xs:element name="secrtySbj" type="tns:SecrtySbj"/>

</xs:sequence>

</xs:complexType>

<xs:element name="authenticateRequest" type="tns:AuthenticateRequest"/>

<xs:complexType name="AuthenticateResponse" >

<xs:sequence>

<xs:element name="sessnId" type="xs:string"/>

</xs:sequence>

</xs:complexType>

<xs:element name="authenticateResponse" type="tns:AuthenticateResponse"/>

<xs:complexType name="customFault">

<xs:sequence>

<xs:element name="customCd" type="xs:int"/>

<xs:element name="customMsg" type="xs:string" minOccurs="0"/>

<xs:element name="customExcp" type="xs:string" minOccurs="0"/>

</xs:sequence>

</xs:complexType>

<xs:element name="customFault" type="tns:customFault"/>

</xs:schema>

</wsdl:types>

<wsdl:message name="authRequest">

<wsdl:part name="parameters" element="tns:authenticateRequest"/>

</wsdl:message>

<wsdl:message name="authResponse">

<wsdl:part name="result" element="tns:authenticateResponse"/>

</wsdl:message>

<wsdl:message name="CustomFault">

<wsdl:part name="CustomFault" element="tns:customFault"/>

</wsdl:message>

<wsdl:portType name="AuthenticateServiceInterface">

<wsdl:operation name="authenticate">

<wsdl:input message="wns:authRequest" />

<wsdl:output message="wns:authResponse" />

<wsdl:fault name="CustomFault" message="wns:CustomFault"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="AuthenticateServiceSoapBinding" type="wns:AuthenticateServiceInterface">

<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>

<wsdl:operation name="authenticate">

<soap:operation soapAction=""/>

<wsdl:input>

<soap:body use="literal"/>

</wsdl:input>

<wsdl:output>

<soap:body use="literal"/>

</wsdl:output>

<wsdl:fault name="CustomFault" >

<soap:fault name="CustomFault" use="literal" />

</wsdl:fault>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="AuthenticateServiceService">

<wsdl:port name="AuthenticateService" binding="wns:AuthenticateServiceSoapBinding">

<soap:address location="http://10.236.14.6:8080/axis/services/AuthenticateService"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

Axis generates the soap fault as below in detail tag as below

<ns1:customFault xmlns:ns1="http://ws.examplenterprise.com">

<ns1:customCd>123</ns1:customCd>

<ns1:customMsg>Password is wrong</ns1:customMsg>

<ns1:customExcp>CustomException</ns1:customExcp>

</ns1:customFault>

They are getting error like below while getting the fault message.

<SAP:ApplicationFaultMessage namespace="http://ws.exampleenterprise.com">customFault<SAP:ApplicationFaultMessage>

Question: Why it is throwing "ApplicationFaultMessage" for fault messages? is there any error in wsdl file in defining the elements? or style has to be different? or is it an namespace issue in the wsdl?

Note: They are able to do it sucessfull for the response message.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

go through this weblog....

Handling Web Service SOAP Fault Responses in SAP NetWeaver XI

/people/jin.shin/blog/2007/05/21/handling-web-service-soap-fault-responses-in-sap-netweaver-xi

Best Regards,

Srikanth

Reward the useful answers and you will get

<a href="/people/baris.buyuktanir2/blog/2007/04/04/point-for-points-reward-yourself

yourself

Answers (1)

Answers (1)

Former Member
0 Kudos

Jaya,

when you fault message from SOAP it because of Application error that is why you see ApplicationFaultMessage. to dispaly this you follow strucre given the stefan blog which listed above.

it should be <details>

<elements>

</details>

Regards

Sreeram.G.Reddy

Former Member
0 Kudos

is it valid application fault message? or error in mapping configuration.

is it error in wsdl file? the fault xml i posted is part of detail tag

Former Member
0 Kudos

Hi Jayaprakash,

I hope this is the format of Fault Message thrown by the webservice. U can check from any stand alone SOAP client for Fault cases.

<SAP:ApplicationFaultMessage namespace="http://ws.exampleenterprise.com">customFault<SAP:ApplicationFaultMessage>

Now your webservice is throwing

fault namespace

customFault http://ws.exampleenterprise.com

Now the important thing is that the WSDL that you have provided to XI has also the same Element name customFault(Case Sensitive) as Fault Type and namespace as http://ws.exampleenterprise.com. If there is any discrepancy between the WSDL provided and the fault message (Not the Payload of Fault Message) thrown by webservice, XI will treat it only as System Error and not as Application Error.

So it is the duty of the WSDL provider to check if the WebService conforms to the WSDL Provided. If not regenerate the correct WSDL or correct the SOAP Service.

PS: For XI namespace is highly critical unlike stand alone Java Program. If there is any discrepancy alter the WSDL or SOAP Service. Else it wont work.

Hope it clears your doubts.

Regards,

Sudharshan N A

Former Member
0 Kudos

Hi Sudharsan,

Thanks for your reply. I have a doubt like <wsdl:Message> element for fault Message <b>CustomFault</b> is from namespace "http://ws.example.com/service" but it refers part element which is from namespace "http://ws.exampleenterprise.com". Why it is throwing the error?

Wsdl defines the above namespaces for request & response.

I am getting error only for fault messages and not for request/response.

Thanks,

Jayaprakash

Former Member
0 Kudos

Hi,

The answer is in your Question itself.

XI Sequence

1.First step is to identify the wsdl:Message element with the namespace http://ws.example.com/service

2.The next step is to go to the part element in http://ws.exampleenterprise.com and map the fault message.

To be simple in your case http://ws.example.com/service is the namespace of Fault Message and http://ws.exampleenterprise.com is the namespace of the fault message payload (Fault XML Message).

So even though the Fault XML Message has the namespace http://ws.exampleenterprise.com ,but if the fault namespace doesnot come with http://ws.example.com/service then Fault will not be triggered and processed in XI.

I hope you get the difference between the two namespaces used and the implications of them.

Fault is entirely different from respone.

Its like exception in java. If you donot catch the correct exception, will the exception raised be caught? Similarly if your SOAP service doesnot invoke the fault message with correct namespace (http://ws.example.com/service ), you cannot invoke/catch the fault message in XI.

Regards,

Sudharshan N A

Former Member
0 Kudos

Thanks for your reply and explaining me the concept in XI.

Is there any xml message for fault handling (i.e., say for an example - this is the way XI expects for fault message with namespaces), so that i can tune the webservice to send it like that.

Regards,

Jayaprakash