camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Processor to xpath
Date Wed, 07 Mar 2012 21:55:07 GMT
On Wed, Mar 7, 2012 at 10:48 PM, byoung4877 <byoung4877@gmail.com> wrote:
> Hi, Please Help!! I'm pretty new to camel so bear that in mind. I'm trying to
> inject a header in to a message from a Processor I've implemented. However,
> when I run I keep getting this:
>
>  [Fatal Error] :1:1: Content is not allowed in prolog."
>

This kind of error is from the XML parser that says the message is not
valid XML. eg the message should have that XML header in the top, with
<?xml version="1.0">

So when the message is evaluated as an XML using the xpath expression
it will fail.
Are you sure its an XML message?

Instead of <xpath> you can use <simple> to evaluate a header

<simple>${header.fileAccepted} == true</simple>



> Below is my camel context:
>
> <bean id="billingRequestProcessor"
> class="com.foobar.BillingRequestProcessor"/>
> <camelContext id="camelContext"
> xmlns="http://camel.apache.org/schema/spring">
> <route>
>  <from uri="file:C:\FTP\BILLING_REQUEST_PENDING?delete=true"/>
>  <process ref="billingRequestProcessor"/>
>  <choice>
>    <when>
>      <xpath>$fileAccepted = 'true'</xpath>
>        <to uri="file:C:\FTP\BILLING_REQUEST"/>
>    </when>
>    <otherwise>
>        <to uri="file:C:\FTP\BILLING_REQUEST_ERROR"/>
>    </otherwise>
>  </choice>
> </route>
> </camelContext>
>
> And in BillingRequestProcessor I am doing some processing resulting in:
>
> @Override
> public void process(Exchange exchange) throws Exception {
>  Map<String, Object> headers = exchange.getIn().getHeaders();
>  headers.put("fileAccepted", "true");
>  exchange.getIn().setHeaders(headers);
> }
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Processor-to-xpath-tp5545719p5545719.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cibsen@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.blogspot.com/
Author of Camel in Action: http://www.manning.com/ibsen/

Mime
View raw message