on 04-18-2016 8:55 AM
Hi,
I have PO 7.4 installed with the latest SP.
I am calling a synchronous REST service from SAP (RFC to REST interface) , and in case of an error, I get for instance a 409 HTTP error code, and there is payload where I can get the error message in one of the fields. I want to fetch this error message and pass it into my mapping.
If I don't configure anything in Error Handling tab - the whole message is going to fail in PO: Not good for me.
If I configure any special handling, such as Custom Result, I can pass a fixed payload into my mapping. How can I put something from the error JSON payload into this custom message?
Thanks
Yoni
I researched a little about REST best practices and it seems as though the correct way to send applicative error in REST is using 4XX HTTP error code.
If this is the case then the PI REST adapter has to support showing data from the payload that comes with the error. How else is the user going to guess what happened.
As an example I am attaching an error response I get from an e-commerce service. Its clear in this case that without access to the payload I cannot supply any meaningful information to the caller of the service.
This looks to me like a serious flaw in the adapter. Any ideas here? Will SAP fix that in the future? Any ways around this?
Thanks
Yoni
HTTP/1.1 409 Conflict
Cache-Control: no-cache
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: application/json; charset=utf-8
Expires: -1
x-vol-has-error: 1
x-vol-correlation: de10a6cabb7245c6a8ba377e200d9c33
x-vol-mrp: RP02
Date: Mon, 18 Apr 2016 10:40:01 GMT
{"category":"mozu","applicationName":"CommerceWebApi","errorCode":"VALIDATION_CONFLICT","message":"Validation Error: The product with code: S4013C2 will have processed quantities that exceed the quantity of the items in the order.","additionalErrorData":[],"items":[]}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Yoni,
I think currently it's not possible to use specific elements of the JSON response in case of a non 20x response, but you can use {http_result} which contains the whole json payload, so in your case it would contain:
{"category":"mozu","applicationName":"CommerceWebApi","errorCode":"VALIDATION_CONFLICT","message":"Validation Error: The product with code: S4013C2 will have processed quantities that exceed the quantity of the items in the order.","additionalErrorData":[],"items":[]}
Therefore you might configure all non 20x responses to create a custom result where you fill {http_result} in a specific (optional) errorMessage field. If required you could then parse/rework the JSON string from this field in the response message mapping in order to built a more readable result.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.