camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <james.strac...@gmail.com>
Subject Re: How to enrich message with the result of other invocation
Date Tue, 30 Oct 2007 16:40:57 GMT
On 29/10/2007, Roman Kalukiewicz <roman.kalukiewicz@gmail.com> wrote:
> Hello!
>
> I'm looking for elegant solution for following problem:
>
> I receive request that is an XML document or object. I need to enrich
> it (add new element or set a property). The problem is that the value
> I want to enrich with is the result of some endpoint invocation.
>
> I know that I can do it using custom processor, but maybe there is
> some Expression instance that evaluates to result of endpoint
> invocation? this way I can simply use setBody() or setHeader() methods
> with such Expression.
>
> Or maybe there is better way to do it? I'm just curious if I can avoid
> using custom processors and express everything in DSL.

Interesting use case! :) Am sure over time we'll figure out nicer and
richer ways of putting all kinds of things like this into the DSL.

I wonder if we could expose 'invoke an endpoint' nicely inside XSLT or
XQuery to make it easy to enrich messages that way?

Am sure we could do something like

let $doc := .
for $invoke in camel-invoke("some-uri")/*
return <result>{ $doc, $invoke }</result >

I couldn't see an easy way to use XQuery to say effectively, 'add the
XQuery expression into the context node as a child' - am sure with
more XQuery ninja there's a way to do it a bit cleaner.

I've just added some XQuery tutorial links to the site BTW:
http://cwiki.apache.org/CAMEL/xquery.html
-- 
James
-------
http://macstrac.blogspot.com/

Open Source SOA
http://open.iona.com

Mime
View raw message