Skip to Content

Call GET RESTful service based on XML elements

Hi Experts,

Say I have a sample input XML as below

<root>
	<element>http://www.foo.com/getStatus/1234</element>
	<element>http://www.foo.com/getStatus/4567</element>
	<element>http://www.foo.com/getStatus/8910</element>
<root>

In the iFlow, I need to traverse the XML, get all the values in each of the elements, use them as Address in the Receiver HTTP channel and trigger the service call.

So in the sample code, there has to be 3 GET web service calls.

For the response processing, I don't need to aggregate them. So I'm thinking of just writing each response for every call to the Data Store.

Is this feasible?

Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 24, 2017 at 10:40 PM

    Hi Mark

    Your solution will look something like the following:

    Set the Splitter (note that there is no Gather step) to split the input with XPath expression /root/element.

    In the Content Modifier, create header CamelHttpUri, and set its value to the XPath expression /root/element. This will set the HTTP channel address for each iteration.

    Finally, add whatever processing you need between the Request-Reply step and the End step.

    Have fun :-)

    Regards,

    Morten

    Add comment
    10|10000 characters needed characters exceeded