Skip to Content
0

Consuming REST Service without message body in response

Dec 13, 2016 at 10:31 AM

161

avatar image

Hi experts,

There is a REST web service that we need to consume in HCI via GET method. If there's no error, only HTTP 204 is returned in a Header field called 'status' - no response payload /message body obviously. The only time that there will be response body is if there's an error like HTTP 503 which can also be found in the same 'status' Header field plus an error message in the response body.

The problem is we need to return a response to the consumer (Sender). But since there's no response message body when the web service returns HTTP 204, how can we access the 'status' Header field and maybe integrate it in a body created via a Content Modifier?

Appreciate any inputs. Thanks!

10 |10000 characters needed characters left characters exceeded

Hi Mark,

How did you consume the web service from within the Integration Process box in your iflow?

Is there a connector I can use to consume a web service from within integration box ?

I am looking to consume from a cloud based webservice and use the retrieved data to push to another cloud based web service.

Please suggest

0
2
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Best Answer
Morten Wittrock Dec 13, 2016 at 01:38 PM
0

Hi Mark

Adding the contents of your status header to the message body in a Content Modifier step is easy: Just insert ${header.status}

However, all headers are removed, unless you actively add them to the list of allowed headers. In order to do that, click somewhere in the background of your Integration Flow, choose the Runtime Configuration tab and add "status" to the Allowed Header(s) field.

Regards,

Morten

Show 3 Share
10 |10000 characters needed characters left characters exceeded

Thanks for the info Morten! Was also able to get the header details using ${in.headers}

0

No problem. And yes, in.header.x, in.headers.x, header.x and headers.x are all synonymous. I've blogged about the Simple expression language, if you'd like to know more.

1

Thanks for sharing! Awesome stuff.

0