Hi
Would be nice if you guys can help me with the proper way os using Xpath in
Spring DSL
I am trying to extract a value from incomign XML file using Xpath and trying
to set it to header. The route is as follows
*
<route id="b2mml_ftp_pickup">
<from
uri="ftp://{{ftpUser}}@{{ftpHost}}{{path}}?password={{ftpPassword}}&move=/in/b2mml/arc"
/>
<log message="Received file ${file:name} from MES" />
<convertBodyTo type="java.lang.String">
<description><from
uri="file://D:/input"/></description>
</convertBodyTo>
<setHeader headerName="ID">
<xpath
resultType="java.lang.String">//ProductionResponse/ProductionRequestID/text()</xpath>
</setHeader>
<log message="The ID extracted is ${in.header.ID}" />
<to uri="activemq:processXML" />
</route>*
Unfortunately the output doesn't contain the extracted value. The output is
as follows.
2014-03-26 06:59:30,141 [0sreao/in/b2mml] INFO b2mml_ftp_pickup
- Received file ProductionPerformance1 (1).xml from MES
2014-03-26 06:59:30,152 [0sreao/in/b2mml] INFO XPathBuilder
- Created default XPathFactory
com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl@1c3820e3
2014-03-26 06:59:30,200 [0sreao/in/b2mml] INFO b2mml_ftp_pickup
- *The ID extracted is *
2014-03-26 06:59:30,799 [mer[processXML]] INFO b2mml_FileBody_JavaObject
- Converting following XML into Java Object for mapping <?xml version="1.0"
encoding="UTF-8" standalone="yes"?>
The incoming XML is
<?xml version="1.0" encoding="utf-8"?><ProductionPerformance
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:Extended="http://www.wbf.org/xml/B2MML-V0401-AllExtensions"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.wbf.org/xml/B2MML-V0401"><ID>PERFORMANCE_1</ID><PublishedDate>2014-03-19T07:18:19.2099611Z</PublishedDate><ProductionResponse><ID
/><ProductionRequestID>2.38</ProductionRequestID><StartTime>2013-07-15T10:39:49.69</StartTime><EndTime>2013-07-15T10:00:00</EndTime></ProductionResponse><ProductionResponse><ID
/><ProductionRequestID>2.38</ProductionRequestID><StartTime>2013-07-15T10:39:49.69</StartTime><EndTime>2013-07-15T10:00:00</EndTime></ProductionResponse><ProductionResponse><ID
/><ProductionRequestID>2.38</ProductionRequestID><StartTime>2013-07-15T10:39:49.69</StartTime><EndTime>2013-07-15T10:00:00</EndTime></ProductionResponse></ProductionPerformance>
--
View this message in context:
http://camel.465427.n5.nabble.com/Issue-with-SetHeader-Xpath-tp5749368.html
Sent from the Camel - Users mailing list archive at Nabble.com.