Skip to Content

SAP CPI : iFlow - Exception process block - access HTTP status code

Hello experts,

${header.CamelHttpResponseCode} : Is this the correct header parameter to get the HTTP status code when an exception occurs?

I am unable to access this value in exception sub-process block in the iFlow.


Add comment
10|10000 characters needed characters exceeded

1 Answer

  • Best Answer
    Posted on Feb 03 at 05:37 PM

    Hi Keshav,

    in case of an exception (subprocess) it should also be possible to read the status code from the exception. In Groovy you would write something like this:

    import java.util.HashMap;
    def Message processData(Message message) {
    	def map = message.getProperties();
    	def ex = map.get("CamelExceptionCaught");
    	if (ex!=null) {
    		message.setHeader("status_code", ex.getStatusCode());
    	return message;

    Then you could access the status code after the script step via the "status_code" header for routing purposes, etc.

    Best regards,

    Add comment
    10|10000 characters needed characters exceeded

    • Thanks for your reply Raffael. Unfortunately, not all methods [get*] listed for the SoapFault in will return details of the fault. I am, however able to get the status code and a message [does not detail the cause of exception], to use in the error log for my response message.

      I did notice that in message monitoring, 'Open Text View' in the Logs [even in case of log level Info] has details of the exception, like the status text etc. I believe to get these log details, we will have to use the ODATA API to query the message processing log (?)