Return-Path: Delivered-To: apmail-activemq-camel-user-archive@locus.apache.org Received: (qmail 27059 invoked from network); 31 Oct 2007 16:23:20 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 31 Oct 2007 16:23:20 -0000 Received: (qmail 99976 invoked by uid 500); 31 Oct 2007 16:23:08 -0000 Delivered-To: apmail-activemq-camel-user-archive@activemq.apache.org Received: (qmail 99954 invoked by uid 500); 31 Oct 2007 16:23:08 -0000 Mailing-List: contact camel-user-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: camel-user@activemq.apache.org Delivered-To: mailing list camel-user@activemq.apache.org Received: (qmail 99945 invoked by uid 99); 31 Oct 2007 16:23:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 09:23:08 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of james.strachan@gmail.com designates 66.249.82.227 as permitted sender) Received: from [66.249.82.227] (HELO wx-out-0506.google.com) (66.249.82.227) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 31 Oct 2007 16:23:09 +0000 Received: by wx-out-0506.google.com with SMTP id s14so217330wxc for ; Wed, 31 Oct 2007 09:22:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=sfYx8TAvXCr3t4FLD1jaNrfvRZzk4X0wN8F/ppNP08Q=; b=ZwHEX+4hx0YZ6tQ5Xl1B0ZE2kbWFhBWqQOCFeOBD7XeDIweeE6PQHzZZHuWWwt+wiMVZVFUK4XnitbIFXVQSdl3RSdz+UacLZXs01l54fRjND2lpGK0hYFutqQ2KvY9Wu++2YR0B6M/GyWwFEJz0A/eQ8Rj7j4yq1HDvwUS4bkA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=opsY6ZYpLfpScDWxjfO1NUPt+gJs7QqhKcj5bKmsPKhszTj6VEAe0wJnoBdnSFSlVBFC28Cet0MR8GXGj9DsbeM/maUGVivhjeZtufo7o1f7JNwor0UZIHX4fILJq+88x+V/krSh3EGMixlMpdCeu2rL4jpc5GivCj6xxH48PUE= Received: by 10.90.102.20 with SMTP id z20mr6692142agb.1193847768555; Wed, 31 Oct 2007 09:22:48 -0700 (PDT) Received: by 10.90.67.7 with HTTP; Wed, 31 Oct 2007 09:22:48 -0700 (PDT) Message-ID: Date: Wed, 31 Oct 2007 16:22:48 +0000 From: "James Strachan" To: camel-user@activemq.apache.org Subject: Re: How to enrich message with the result of other invocation In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: X-Virus-Checked: Checked by ClamAV on apache.org On 30/10/2007, James Strachan wrote: > 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 { $doc, $invoke } > > 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. A maybe cleaner way to do it in XQuery is something like this... {/*} {camel-invoke('some-uri')} This will embed the original document inside then the result of the camel-invoke method in there too. I've not seen a cleaner way to put the invocation inside the first child of the input yet though. -- James ------- http://macstrac.blogspot.com/ Open Source SOA http://open.iona.com