I managed to get that working.
I have another question on the route configuration:
Assuming the following xml snippet:
<pss:info>
<personFile>098765432.txt</personFile>
<address>
<street>xyz</street>
<city>Frankfurt</city>
</address>
<persons>
<person>
<name>joe</name>
<age>32</age>
<country>Germany</country>
</person>
<person>
<name>sam</name>
<age>32</age>
<country>Germany</country>
</person>
</persons>
</pss:info>
The task was to get the List of Person which I managed to extract using
xpath. I would also want to get the fileName value and set that as a header
in my Exchange. My route definition is as below:
from("file://C:/folders/inbox?noop=true")
.setFileNameHeader(ns.xpath("/SOAP:Envelope/SOAP:Body/pss:info/personFile/text()"))
.split(ns.xpath("//SOAP:Envelope/SOAP:Body/pss:info/persons"))
.bean(new PersonProcessor())
.to("file://C:/folders/inbox");
But I get the following error message shown:
The method setFileNameHeader(XPathExpression) is undefined for the type
RouteDefinition
The setHeader also seems to be wrong.
Regards,
Jothi
On Fri, Aug 24, 2012 at 9:35 PM, Christian Müller <
[email protected]> wrote:
> Yes, should be possible.
>
> Sent from a mobile device
> Am 24.08.2012 13:56 schrieb "Joe San" <[email protected]>:
>
> > The most common language to use is XPath, which allows you to evaluate
> > XPath
> > expressions on the message body. For example, suppose the message
> contains
> > the following
> > XML document:
> >
> > <order customerId="123">
> > <status>in progress</status>
> > </order>
> >
> > By using XPath expressions, you can extract parts of the document and
> bind
> > them to
> > parameters, like this:
> >
> > public void updateStatus(@XPath("/order/@customerId") Integer customerId,
> > @XPath("/order/status/text()") String status) {
> > ....
> > ....
> > }
> >
> > The above snippet is from the Camel in Action book. Can I use the @XPath
> to
> > evaluate to a List < Person >?
> >
> > My xml would look like this:
> >
> > <info>
> > <address>
> > <street>xyz</street>
> > <city>Frankfurt</city>
> > </address>
> >
> > <person>
> > <name>joe</name>
> > <age>32</age>
> > <country>Germany</country>
> > </person>
> >
> > <person>
> > <name>sam</name>
> > <age>32</age>
> > <country>Germany</country>
> > </person>
> >
> > </info>
> >
> > The XPath should evaluate the fetch the List of Person objects!
> >
> > Regards,
> > Jothi
> >
>