cancel
Showing results for 
Search instead for 
Did you mean: 

Catch HTTP recevier error to use it as response data to return to client

Former Member
0 Kudos

Hello,

I'm looking for a possibility to catch the HTTP errors during a message delivery through plain HTTP receiver adapter or SOAP receiver adapter. The message must be available because the adapter easily catches the message and shows it in SXMB_MONI.

Now I want to extract some useful information out of the error message and use it to return to the sync RFC client.

Is it possible without BPM to 'catch' the error message and map it to the client response using a sync scenario?

My second attempt was to build a small BPM to catch the exception and extract some data.

Although the exception is catched I'm still struggling how to get the error information which should be included in the exception. I was also unable to build the response with the use of a simple container operation and the use of some constants. It seems that the container operation isn't able to write data to a message (abstract interface).

I tried to find some useful information on the web without success.

Maybe someone is able to give me a hint what could be a possible solution.

Any help would be appreciated.

Thanks.

Regards,

Marc

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hello Stefan,

thanks for your fast reply.

Good idea. I haven't been thinking about a additional adapter module.

I will try it.

Regards,

Marc

stefan_grube
Active Contributor
0 Kudos

You can do this in an adapter module.

You have to use the SOAP adapter and check the flag "Do not use SOAP envelope" The adapter module checks the content-type of the payload (or checks for starting tag "html").

You can get the error text from XI message header, so you can create a valid response.

See this code for retrieving the HTTP error message from XI message header:

boolean error = false;
String errorMessage = "";
ErrorInfo errorInfo = xiMessage.getErrorInfo();
String[] attributeNames = errorInfo.getSupportedAttributeNames();
for (int i=0;i<attributeNames.length;i++){
error = true;
if("AdditionalErrorText".equals(attributeNames<i>)) errorMessage = errorInfo.getAttribute(attributeNames<i>); 
}

At the end you have to switch the content type from html to xml:

xMLPayload.setContentType("application/xml");

Put your module after the standard SOAP adapter module.

Hope that helps

Stefan