file endpoint to xquery problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

file endpoint to xquery problem

nono
This post was updated on .
In my camel route has below route , which send file input to xquery to
generate file output. as below shown

################# camel route ##############

from("file:src/data?moveFailed=.error").
to("xquery:myxquery.xq").to("file:target/output");


My problem is myxquery.xq file it has a function which expecting a variable
called $myTestRequest

How can I pass the message after file endpoint as the variable
($myTestRequest  )and give it to XQuery endpoint to use? Any hints will be
more than welcome!


############ Below is snippet code of myXQuery ###############
declare variable $myTestRequest as element(ns:MyTestRequest) external;
xf:convert_To_InternalRequest($myTestRequest)


############################
what i tried is

declare variable $in.body as element(ns:MyTestRequest) external;
xf:convert_To_InternalRequest($in.body)

and in camel
from("file:src/data?moveFailed=.error").convertBodyTo(String.class).
to("xquery:myxquery.xq").to("file:target/output");

Exception what i got is
Caused by: net.sf.saxon.trans.XPathException: Required item type of value of variable $in.body is element ; supplied value has item type xs:string

BTW I dont know why i could reply this thread? when i click reply. it pop up a dialog, after i enter reply, nothing happens. it seems go to mailing list again..

Reply | Threaded
Open this post in threaded view
|

Re: file endpoint to xquery problem

Claus Ibsen-2
Hi

Have you tried setting that as a header value - I think there is
something with xquery where you can refer to headers by their name.


On Tue, Sep 18, 2018 at 4:52 PM Wang Yan <[hidden email]> wrote:

>
> In my camel route has below route , which send file input to xquery to
> generate file output. as below shown
>
> ################# camel route ##############
>
> from("file:src/data?moveFailed=.error").
> to("xquery:myxquery.xq").to("file:target/output");
>
>
> My problem is myxquery.xq file it has a function which expecting a variable
> called $myTestRequest
>
> How can I pass the message after file endpoint as the variable
> ($myTestRequest  )and give it to XQuery endpoint to use? Any hints will be
> more than welcome!
>
>
> ############ Below is snippet code of myXQuery ###############
> declare variable $myTestRequest as element(ns:MyTestRequest) external;
> xf:convert_To_InternalRequest($myTestRequest)



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2