Skip to Content

Some times it is required that we need to dynamically configure the HTTP address field while using an HTTP receiver adapter. HCI enables flexibility in declaring variables in Address URL and also in Query which is transferred with HTTP request.

In the following flow, we call a Product Search service REST API on an on-premise Hybris system which is called from HCI using Hana Cloud Connector. The products fetched differs  based on the variable User Group we pass in the Request Path of the URL.

Let discuss how we can configure this dynamically in Target URL. In my case I have the following URL to fetch products.
http://tst.admin.shop.hybris/rest/v2/${header.UserGroup}/products/search

As of now SAP HCI only supports using header.variable in the Address field. i.e. ${header.foo} in address field would get the value of header foo ( as contained in the  incoming message ) and will be written to  Camel header CamelHttpUri.

In Query of the HTTP adapter, we could use both header.variable and property.variable for defining parameters in Query which will be written to Camel header CamelHttpQuery..

SAP standard documentation about the HTTP Receiver adapter is quite detailed and covers most of the properties we could define on the adapter.

In the above Iflow before calling the Products Search API, below subflow to fetch the User Groups is defined.

Again here a call to Hybris is made to get Customer Groups using HTTP receiver adapter.


The response from the call is JSON which is further converted to  XML by introducing an Root element using a content modifier.

<?xml version="1.0" encoding="UTF-8"?>
<Root xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <userGroups>
        <name>B2B Group</name>
        <uid>b2bgroup</uid>
    </userGroups>
    <userGroups>
        <name>B2B Customer Group</name>
        <uid>b2bcustomergroup</uid>
    </userGroups>
    <userGroups>
        <uid>UG_US02_01</uid>
    </userGroups>
    <userGroups>
        <uid>customergroup</uid>
    </userGroups>
</Root>

From the above XML, we need to pick value of the element value contained in tag <uid>UG_US02_01<uid> which is under element <userGroups>.

For this we could define a Header variable “UserGroup” using content modifier with XPATH value substring(//uid[starts-with(.,’UG_’)],4) which returns value US02_01.

This value is further passed to mainflow from where this subflow was called. Eventually header.UserGroup replaces the following URL
http://tst.admin.shop.hybris/rest/v2/${header.UserGroup}/products/search

into

http://tst.admin.shop.hybris/rest/v2/US02_01/products/search

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply