cancel
Showing results for 
Search instead for 
Did you mean: 

How to read MPL attachments from odata api as part of exception handling in SAP CI

SubinSudhakaran
Explorer
0 Kudos
434

Hi,

Scenario:

We are trying to post data to S4 OData api from sap CI and we want to test the exception handling part whenever there is failure in data posting to S4 . The error has to be captured and sent as a mail alert. 

I can see that CamelExceptionCaught contains error message as "Bad Request 400", but I need the actual error message, like "No delivery available for update".

In the OData Response body attachments i can see the actual error reason, but its not getting stored anywhere in the header or properties. 

Bad request error.png

Attachments.png

actual error message.png

 

 

View Entire Topic
Dinu
Contributor

You get the response body from the exception.  There is no need to read MPL. There is sample for the script to do this in the documentation. 
https://help.sap.com/docs/integration-suite/sap-integration-suite/handle-exceptions

SubinSudhakaran
Explorer
0 Kudos

Hi Dinu, thanks for the reply. i tried this before but it didnt work.

I tried with the 2nd script in link, odata v2 receiver adapter script. it logs three additional attachments in CI, as shown below. It was logging odata post url, previous step payload, http status code. And there are no headers or poperties which actually specifies the reason for bad request.

9MJa0ZoREj.pngRnpq6pZ3lk.pngx2IwPLv0vQ.png

Property:

bstgCj41Bg.png

 

Header:

qyw8oDy788.png

Dinu
Contributor
0 Kudos
The script writes response from odata receiver to MPL. You can delete this line, it is duplicate of ODataV2_Adapter_Response_Body if you mark Attach Error Details on failure. But, it sets a property named http.response too. This you can process in the iFlow. You dont have to read ODataV2_Adapter_Response_Body from MPL. Is http.response is not same as ODataV2_Adapter_Response_Body? You wrote that it contained previous step payload. Perhaps there is something else overwriting it.
SubinSudhakaran
Explorer
0 Kudos
Thats right. it was overwriting. the script was placed after the content modifier. Now its moved before and its working. thanks.