<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: SAP CPI : iFlow - Exception process block - access HTTP status code in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144570#M4539593</link>
    <description>&lt;P&gt;Hi Keshav, &lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import com.sap.gateway.ip.core.customdev.util.Message;
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;
}
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then you could access the status code after the script step via the "status_code" header for routing purposes, etc.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Raffael&lt;/P&gt;</description>
    <pubDate>Mon, 03 Feb 2020 17:37:49 GMT</pubDate>
    <dc:creator>r_herrmann</dc:creator>
    <dc:date>2020-02-03T17:37:49Z</dc:date>
    <item>
      <title>SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaq-p/12144567</link>
      <description>&lt;P&gt;Hello experts,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt; ${header.CamelHttpResponseCode} : Is this the correct header parameter to get the HTTP status code when an exception occurs?&lt;/P&gt;
  &lt;P&gt;I am unable to access this value in exception sub-process block in the iFlow.&lt;/P&gt;
  &lt;P&gt;Regards&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:00:46 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaq-p/12144567</guid>
      <dc:creator>KeshavDesai</dc:creator>
      <dc:date>2020-02-03T14:00:46Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144568#M4539591</link>
      <description>&lt;P&gt;Yes this is the correctly one, but why you are cannot access it? could you provide a print about this configuration inside the I-Flow?&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 14:07:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144568#M4539591</guid>
      <dc:creator>former_member608139</dc:creator>
      <dc:date>2020-02-03T14:07:31Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144569#M4539592</link>
      <description>&lt;P&gt;Hi Carlos, &lt;/P&gt;&lt;P&gt;Thanks for the reply. I am accessing this expression &lt;/P&gt;&lt;P&gt;${header.CamelHttpResponseCode}  in the message body of a content modifier in an exception process block. &lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 15:17:23 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144569#M4539592</guid>
      <dc:creator>KeshavDesai</dc:creator>
      <dc:date>2020-02-03T15:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144570#M4539593</link>
      <description>&lt;P&gt;Hi Keshav, &lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;import com.sap.gateway.ip.core.customdev.util.Message;
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;
}
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then you could access the status code after the script step via the "status_code" header for routing purposes, etc.&lt;/P&gt;&lt;P&gt;Best regards,&lt;BR /&gt;Raffael&lt;/P&gt;</description>
      <pubDate>Mon, 03 Feb 2020 17:37:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144570#M4539593</guid>
      <dc:creator>r_herrmann</dc:creator>
      <dc:date>2020-02-03T17:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144571#M4539594</link>
      <description>&lt;P&gt;Thanks Raffael. Yes, I can get the status code in the script. Surprised why the same cannot be accessed using the simple expression in the content modifier [by creating a new header/exchange property/even while setting the body].&lt;/P&gt;&lt;P&gt;Also, what other methods can we access from the exception object [&lt;/P&gt;&lt;P&gt;def ex = map.get("CamelExceptionCaught");]? In my case I am getting a &lt;/P&gt;&lt;P&gt;org.apache.cxf.binding.soap.SoapFault exception.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Feb 2020 14:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144571#M4539594</guid>
      <dc:creator>KeshavDesai</dc:creator>
      <dc:date>2020-02-04T14:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144572#M4539595</link>
      <description>&lt;P&gt;Hi Keshav,&lt;/P&gt;&lt;P&gt;there are also methods like "getStatusText" and "getResponseBody" in the exception object. Check the samples over here: &lt;A href="https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/a443efe1d5d2403fb95ee9def1a672d4.html"&gt;https://help.sap.com/viewer/368c481cd6954bdfa5d0435479fd4eaf/Cloud/en-US/a443efe1d5d2403fb95ee9def1a672d4.html&lt;/A&gt;&lt;/P&gt;&lt;P&gt;In addition, maybe you don't need a script to access the status text, but can set it directly to a property by using Apache Simple Expression. It could work like the following (but I haven't tested it - so no proof that it works): &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;${property.CamelExceptionCaught.getStatusCode()}&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Feb 2020 15:41:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144572#M4539595</guid>
      <dc:creator>r_herrmann</dc:creator>
      <dc:date>2020-02-04T15:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: SAP CPI : iFlow - Exception process block - access HTTP status code</title>
      <link>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144573#M4539596</link>
      <description>&lt;P&gt;Thanks for your reply Raffael. Unfortunately, not all methods [get*] listed for the SoapFault in &lt;/P&gt;&lt;P&gt;&lt;A href="https://cxf.apache.org/javadoc/latest/org/apache/cxf/binding/soap/SoapFault.html" target="test_blank"&gt;https://cxf.apache.org/javadoc/latest/org/apache/cxf/binding/soap/SoapFault.html&lt;/A&gt; 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.&lt;/P&gt; 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 (?)</description>
      <pubDate>Fri, 14 Feb 2020 11:39:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/sap-cpi-iflow-exception-process-block-access-http-status-code/qaa-p/12144573#M4539596</guid>
      <dc:creator>KeshavDesai</dc:creator>
      <dc:date>2020-02-14T11:39:44Z</dc:date>
    </item>
  </channel>
</rss>

