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: Problems with dynamic URL
Date Thu, 07 Aug 2014 12:02:46 GMT
Hi

See this FAQ
http://camel.apache.org/how-to-use-a-dynamic-uri-in-to.html

Though mind that when using http components its often better to reuse
same endpoint and provide dynamic parts as headers. As that ensures
only 1 endpoint in use which has less overhead and can reuse resources
next time etc. This can only be done if the remote HTTP server being
called is the same. Then you can provide the HTTP query parameters in
a header. See the table at: http://camel.apache.org/http

Something a like:

<setHeader headerName="Exchange.HTTP_QUERY"><simple>param=${in.body.id}</simple></setHeader>
  <to uri="{{ws.url}}"/>

On Thu, Aug 7, 2014 at 1:26 PM, sergarci <sergarci@gmail.com> wrote:
> Hi all
>
> I'm trying this in my camle route:
>
> <multicast strategyRef="groupedExchangeAggregationStrategy"
> stopOnException="true">
>       <to uri="{{ws.url}}?param=${body.id}" />
>       <log message="aggregate with param: ${body.id}" logName="ranbase" />
> </multicast>
>
> where ws.ur is a property file key like:
> ws.url=http://localhost:8080/service
>
> and ${body.id} is an id wich value I have.
>
> The problem is when I call this comoposed URL it calls my webservice without
> adding this id, it seems is not resolving this value.
>
> Is there any other option I can try?
>
> I've also tried something like:
>
> <setProperty propertyName="completeUrl">
>      <simple>{{ws.url}}?param=${in.body.id}</simple>
> </setProperty >
>
> and use it like:
> <to uri="${property.completeUrl}" />
>
> But then an exception is thrown.
>
> Thanks you all
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Problems-with-dynamic-URL-tp5754894.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Mime
View raw message