on 03-24-2011 1:13 AM
Hi
We have a Sync interface which makes a Proxy call from ECC to PI and then PI makes Soap Sync call to Web application. We are having issues when handling Exceptions. Sender is getting misleading errors in response, even though they are application errors the proxy sender is getting error like MappingObjectNotFound.
When debug the PI system, PI is truncating error info when it return the reponse.
Below is the scenario of Synchronous interface:
ECC(Proxy) -> PI(Soap Receiver Adapter) -> MasterDataApp-(Webserver)
Below is the actual response from Webserver (Extracted via TCPGW sniffer):
<?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>*java.rmi.RemoteException: No Messages Found*</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
But PI receives this response payload like this :
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- XML Validation Inbound Channel Response
-->
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
and then Sync Request mesasge fails with below error because of the unexpected response payload as shown above:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- Call Adapter
-->
- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SAP:Category>XIServer</SAP:Category>
<SAP:Code area="MAPPING">NO_MAPPINGPROGRAM_FOUND</SAP:Code>
<SAP:P1>Object ID B0CC6B27847A368AA04F4171EF6460F4 Software Component 86524CE0304911DEAE48CC6C83461631</SAP:P1>
<SAP:P2 />
<SAP:P3 />
<SAP:P4 />
<SAP:AdditionalText />
<SAP:Stack>Mapping program is not available in runtime cache: Object ID B0CC6B27847A368AA04F4171EF6460F4 Software Component 86524CE0304911DEAE48CC6C83461631</SAP:Stack>
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Also in the response message see this error message:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!--
XML Validation Inbound Channel Response
-->
- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<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="http://xml.apache.org/axis/">hostname</SAP:ApplicationFaultMessage>
<SAP:Stack />
<SAP:Retry>M</SAP:Retry>
</SAP:Error>
Please let me for any clues how to handle this error response.
Thanks,
laxman
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Liang,
Yes, I can use the fault message type but the response fault message is truncated. I get the message in PI like this
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- XML Validation Inbound Channel Response -->
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
but the actual message is truncated..
<?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>java.rmi.RemoteException: No Messages Found</faultstring>
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
The actual error is in the field faultstring but PI is ignoring all and reading only the "detail" section so we are loosing the original error from webserver.
I also tried using XMBWS.NoSOAPIgnoreStatusCode = true but to work this option I have to use the "Do Not Use Soap Envelope" with this webserver rejects the message stating invalid format.
Thanks,
Laxman
Hi Laxman,
SOAP Adapter cannot handle fault responses. I understand your issue. You even want to send the errorneous response from the Webservice as a payload back to the sender. But because of application error from Webservice, you are getting an error in the response message (Mapping Not found). SOAP Adapter cannot handle application error (i.e you will not get the errorneous response in form of payload) . For details please read below:
The receiver adapter expects a SOAP message as response. For synchrnous calls, a successful response should be returned with HTTP 200. In this case, the content of the SOAP body will be returned to the caller as the response payload. When some error occurs, the SOAP message may contain the SOAP fault element. In this case, when the fault detail element is not empty, its content will be returned as the fault payload in an application error message. For others, a system error message will be returned to the caller.
HTTP/1.1 200 OK
Content-Type: text/xml; charset="utf-8"
<SOAP:Envelope
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<m:GetLastTradePriceResponse xmlns:m="Some-URI">
<Price>34.5</Price>
</m:GetLastTradePriceResponse>
</SOAP:Body>
</SOAP:Envelope>
will result in an application response message with response payload
<m:GetLastTradePriceResponse xmlns:m="Some-URI">
<Price>34.5</Price>
</m:GetLastTradePriceResponse>
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
<SOAP:Envelope
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<SOAP:Fault>
<faultcode>SOAP:MustUnderstand</faultcode>
<faultstring>SOAP Must Understand Error</faultstring>
</SOAP:Fault>
</SOAP:Body>
</SOAP:Envelope>
will result in a system error message.
HTTP/1.1 500 Internal Server Error
Content-Type: text/xml; charset="utf-8"
<SOAP:Envelope
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP:Body>
<SOAP:Fault>
<faultcode>SOAP:Server</faultcode>
<faultstring>Server Error</faultstring>
<detail>
<e:myfaultdetails xmlns:e="Some-URI">
<message>My application didn't work</message>
<errorcode>1001</errorcode>
</e:myfaultdetails>
</detail>
</SOAP:Fault>
</SOAP:Body>
</SOAP:Envelope>
will result in an application error message with fault payload
<e:myfaultdetails xmlns:e="Some-URI">
<message>My application didn't work</message>
<errorcode>1001</errorcode>
</e:myfaultdetails>
In order to send the erroneous response as a payload to the sender, you should develop flow in below manner:
ECC(Proxy) -> PI --> ECC(Proxy)
In PI make a SOAP lookup. The response of the SOAP lookup will contain the response given by the WebService (it can be a vaid response or an application error in WebService). Now map this response to the proxy...In this way you can handle the application error msgs from webservice..
I hope this helps you...
Regards,
Rakesh Sharma
Hi Rakesh,
Thanks for sharing your experience in datail.
I have a fault message defined in Sync Interface for exception handling. So technically I want to send the error response as an error using interface fault message. My first problem is that the webservice error response message contains FaultString and also Detail section like below:
<?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>java.rmi.RemoteException: No Messages Found</faultstring>*
<detail>
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
Actual error in field FaultString(this is the most important field in the response message) and detail section has no valuable information, since this response message has detail section PI considering as an application error and reading just detail section as response payload and ignoring the actual FaultString. But I am looking for PI to treat this response as System Error and keep the actual error message with field FaultString.
PI reading response payload as below:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <!-- XML Validation Inbound Channel Response-->
<ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">hostname.com</ns1:hostname>
Please let me know if you have any suggestions.
Thanks,
Laxman
With this we can atlease present the actual error back to caller.
Hello,
I also tried using XMBWS.NoSOAPIgnoreStatusCode = true but to work this option I have to use the "Do Not Use Soap Envelope" with this webserver rejects the message stating invalid format.
You can build your SOAP Envelope using Java or XSLT mapping and use SOAP Adapter to POST to the URL.
Hope this helps,
Mark
Hello,
Here is a sample code taken from SDN wiki:
https://wiki.sdn.sap.com/wiki/display/XI/SampleJAVAMappingcodeusingPI7.1+API
Your logic will be more or less similar to this
import java.io.InputStream;
import com.sap.aii.mapping.api.AbstractTransformation;
import com.sap.aii.mapping.api.StreamTransformationException;
import com.sap.aii.mapping.api.TransformationInput;
import com.sap.aii.mapping.api.TransformationOutput;
import com.sap.aii.utilxi.core.io.IOUtil;
public class ParseResponse extends AbstractTransformation {
public void transform(TransformationInput input, TransformationOutput output)
throws StreamTransformationException {
try {
String flatData = "";
//open inputStream for input payload and outputStream for output payload
InputStream inputStream = input.getInputPayload().getInputStream();
inputStream.close();
flatData = IOUtil.copyToString(inputStream, "UTF-8");
//Build your request XML by manipulating flatData
output.getOutputPayload().getOutputStream().write(flatData.getBytes("UTF-8"));
} catch (Exception e) {
throw new StreamTransformationException("Mapping failed" , e);
}
}
}
Hope this helps,
Mark
Hello,
The easiest way would be to:
1.) Create a header data type
2.) Create a body data type
3.) Create an envelope data type and call your header and body data type there
4.) Create envelope message type
5.) Use java mapping to find/replace strings e.g <Envelope> to <soapenv:Envelope>
Otherwise, you would have to go using DOM or SAX parsing. You can also build your Envelope and add the tags/prefixes using XSLT Mapping
Hope this helps,
Mark
Edited by: Mark Dihiansan on Mar 25, 2011 6:52 AM
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.