Skip to Content
avatar image
Former Member

How to pass {http_result} from REST receiver adapter to REST sender adapter


We have a scenario where we are running REST-adapter to REST-adapter to expose a POST REST-service to a consumer system. I have a problem with the error handling where we want to respond with the error json payload from the receiver system as well as with the same HTTP Status code we get from the receiver system.

In the REST receiver adapter I am able to catch the error http status codes and set message content to {http_result}.

If I don’t do any error handling on REST Sender-side PI will respond with HTTP 200 OK and the json error payload from receiver system. However, if I want PI to also respond with the same HTTP status code as we get from the receiver system I’m unable to do that.

On the REST Sender side I try to catch the errors from receiver side by looking at the json payload:

“timestamp”: “2017-10-31T10:23:28.274+0000”,
“status”: 400,
“error”: “Bad Request”,
“exception”: “org.springframework.http.converter.HttpMessageNotReadableException”,
“message”: “JSON parse error: Unrecognized token ‘hej’: was expecting (‘true’, ‘false’ or ‘null’); nested exception is com.fasterxml.jackson.core.JsonParseException: Unrecognized token ‘hej’: was expecting (‘true’, ‘false’ or ‘null’)\n at [Source:; line: 1, column: 7]”

But I am unable to also pass the http_result.:

The response to sender system will now be HTTP 400 but with a payload of “{http_result}”. Do you have any suggestions on how I can pass the http_result from REST receiver to REST sender adapter?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Aug 17 at 03:10 PM


    Could you send me a screenshot of your sender e receiver restadapter? I'm trying to define a similar restapater to restadapter interface to expose to user system and no getting results.


    Add comment
    10|10000 characters needed characters exceeded