For the list of all supported Decision Insight downloads and releases, see the Downloads page.

How to inject data into a remote node from a route using the Web services API


This cookbook is for educational purpose only. This is not the recommended way to integrate multiple nodes.


In this cookbook, you will learn how to invoke a mapping located on a node from a route running on another node.

If you want to quickly execute the cookbook, you can use the same product instance for the local & remote one.

Remote node

On the remote node, follow these steps, or directly import the application export_Cookbook_Web_services API_remote.appx.

Create a simple application

  • Create an application "Cookbook for Web services API (remote)"
  • Create a space "remote"
  • Create a 1 minute rhythm
  • Create an entity "Customer"
    • Create an attribute "name" of type String
    • Create an attribute "vip" of type Boolean
    • Create a key with "name" as attribute

Create the mapping

  • Create a Data integration mapping "createCustomer" with 2 parameters: name (String) and vip (Boolean)

Local node

On the local node, follow these steps, or directly import the application export_Cookbook_Web_services API_local.appx

Install Gson DataFormat

Create the route to invoke the mapping

  • Create a route "RemoteMapping" with the following content
    • replace localhost with the name of the remote host if applicable
    • replace the admin/admin credentials if applicable
<routes xmlns="" xmlns:u="">
        <from uri="timer://foo?repeatCount=1"/>
        <!-- Set proper HTTP headers -->
        <setHeader headerName="CamelHttpMethod">
        <setHeader headerName="Content-type">
        <setHeader headerName="Version">
        <!-- Set body using map, then generate a JSON from that -->
                <u:map-entry key="name" value="Acme Corp" />
                <u:map-entry key="vip">
                    <simple resultType="java.lang.Boolean">true</simple>
            <json library="Gson" />
        <convertBodyTo type="String" />
        <!-- Call Web service -->
        <log message="Creating customer on remote node..."/>
        <to uri="http4://localhost:8080/ws/absorb/remote/createCustomer?authMethod=Basic&amp;authUsername=admin&amp;authPassword=admin"/>
        <!-- Convert the result to GSON, then extract the transactionTime into the body -->
            <json library="Gson" />
            <simple resultType="java.lang.Long">${body['transactionTime']}</simple>
        <!-- Log a nice message -->
        <log message="...Customer successfully created on remote node with transactionTime ${body}"/>

Run the route

  • Start the route
  • Go to the logs for the routes, you should see the following messages
Creating customer on remote node...
...Customer successfully created on remote node with transactionTime 1487948593413226496

On the remote node, you should now have a customer named "Acme Corp"  (if not, move the time machine forward as the Customer is created at Now). 

Related Links