2

Please find the below route program,

<routes xmlns="http://camel.apache.org/schema/spring"> 
<route id="com.performancebikes.RouteScript" autoStartup="false"> 
<from uri="b2bmbFileSystem:com.performancebikes/tempSFTP/in"/>
<convertBodyTo type="java.lang.String" charset="UTF-8"/>
<convertBodyTo type="org.w3c.dom.Document" charset="UTF-8"/>
<split>
<xpath>/B2B_Documents/B2B_PurchaseOrder/Header/HeaderInfo/PurchaseOrderNumber/text()</xpath>
<setHeader headerName="body">
  <constant>${body}</constant>
</setHeader>
<log message="${body}"/>
<to uri="b2bmbScript:com.trainingaccount11/Ship" />
</split>
</route> 
</routes>

In this from Xpath expression I am getting the PurchaseOrderNumber as 152346 as expected. now I am setting 152346 to the variable body in the header and send this as input to the script called Ship.

but here is I am not getting 152346 as value to my script. it is going as null.

Please let me know how I can set 152346 value to the header and pass that as a input to my script.

My script is taking the 152346 as input.

aurelius
  • 3,946
  • 7
  • 40
  • 73
Arundhathi D
  • 304
  • 6
  • 22

1 Answers1

2

The b2bmbScript is not an out of the box Apache Camel component and therefore it must be some kind of third-party / homegrown component.

So whatever this component supports to take headers, or whatnot, is totally up to how this component is implemented. Any Camel component have access to all data from the Camel Exchange and Message instance and therefore can get the body, headers, etc.

So look at how this component is implemented, its documentation etc.

Claus Ibsen
  • 56,060
  • 7
  • 50
  • 65