camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
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 <> 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:

Open Source SOA

View raw message