on 2018 Dec 18 7:08 AM
Hi
I have a Synchronous interface message that is to be Received in JSON format. I am using SAP PO7.50 REST Adapter .
If the Request message is received and processed ok then I will get a Response message
But if not processed ok then I will a different message - an Exception message with detail of that.
How do I get the details of the Exception message and put that into the Service Interface Fault message - can this only be done via Comms Channel Error Handling - if so how to extract the error message?
For example.
{"ExceptionMessage": "Invalid property. Collection 'Task' doesn't contain property with name 'LatitudeDecimal'"}
Request clarification before answering.
An update to my question. There is a SAP NOTE that to use {http_result} you need to set a parameter or 2 on the REST Receiver's Module parameters.
SAP Note 2273265 (Problem acessing error response message with internal variable and wrong message type for the generated XI message
You use Process Integration (PI) and you configure a REST receiver channel, which sends the payload to the partner server. If the partner server responds with non-200 HTTP code, you are not able to use internal variable {http_result} in the custom error handling.)
1. If no custom error handling is used and the parameter "useResponseErrorMessage" of the 'rest' module is set to true - then an XI Application Error message is created with original payload from non-200 HTTP call if there is any.
2. If a custom error handling is used and the parameter "setAppErrorOnCustomMessage" of the 'rest' module is set to true - then an XI Application Error message is created with the payload from the configured custom error handling (e.g. internal variable {http_result}).
BUT even with those parameters set I still cannot see the {http_result} value when I use this in my Error Handling message - it just comes out like this unintepreted.
<ExceptionMessage>CLICKFSE Exception occurred: {http_result}</ExceptionMessage>
If I set the REST Adapter Error Handling to nothing ( ---Unused ----) then I will get a ResponseMessage back with the Exception Message HOWEVER an XI Application Fault is raised, the Fault Mapping is not triggered and so the Fault Message is empty - I can trap for an Exception is the ABAP Proxy call but of course the Fault message is empty and I cannot access the Response Message even though I can see it in SXMB_MONI with the exception message but I can't get to it from the Proxy call.We have the latest SAP PO7.50 and yet this does not work as expected. If only the {http_result} worked when I put it into my custom error handling on the REST Adapter but this is not populated - if it did work then no exception is trapped and the response would have the message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
So I still cannot use setAppErrorOnCustomMessage with the {http_result} as it is not translated. I'm on SAP PO7.5 SP10 Patch18 so it should.
I have used instead the useResponseErrorMessage. Although I get the Exception message in my Response the problem is that the Calling Proxy gets a Fault and so that Response message is no longer available and this contains all the information about the error. So in SXMB_MONI I can see the Response message with the error but I cannot get to it during the calling ABAP because an exception is raised.
I think this would be the same case for either setting. i.e. the Exception is getting in the way.
So how do I get to the Response Message as that contains the full error message that I need?
You see the screen shot of my SXMB_MONI after the ABAP proxy call has finished - so I know the Response message contains the error - it is just that I cannot get to this message as the Proxy raises a fault due to the ApplicationError. How can I get to it from the ABAP?.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I know this is old, but in case somebody else comes across it like me just now:
First of all, you need to avoid returning an ApplicationError. This is done with the custom error handling and catching a status code (you can use wildcards in the field "Status Codes"):
In the response mapping, in my example in the screenshot above, I then extract the value of the field <element> which I populate with {http_result} (we're on SP21 and it works) by setting the "element" brick to "return as XML" (right click in the graphical mapping onto the brick) and then use the replaceValue function to strip the http_result's value from it's XML declaration and root (or other unwanted) element(s) (as it otherwise would be duplicated).
Let me know if it's unclear.
Best Regards
Philippe
In the Error Handling tab of CC, you can create your desired error message based on error HTTP Status Code or Status Text
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
24 | |
22 | |
8 | |
6 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.