On Wed, May 13, 2009 at 3:21 PM, Nasim Anza <[email protected]> wrote: > I've tried the Processor solution like following : > > > public void process(Exchange exchange) throws Exception { > try > { > String uri = > exchange.getIn().getHeader(org.apache.camel.component.http.HttpProducer.HTTP_URI).toString(); > > // Modify the URI here > > > ProducerTemplate<Exchange> template = > exchange.getContext().createProducerTemplate(); > Exchange exch = template.send(ENDPOINT_DYNAMIC_HTTP_URI, > exchange); > >
Hi You should be able to just set the complete URI you want to call as a IN header with the key: HttpProducer.HTTP_URI So instead of all the producertmplate stuff you do exchange.getIn().setHeader(HttpProducer.HTTP_URI, "http://helloworld_complete_uri_i_want_to_call"); And then route it to the http component. The header above will take precedens and will be user over the URI defined on the http endpoint. > > On Wed, May 13, 2009 at 11:43 AM, Willem Jiang <[email protected]>wrote: > >> How about write a processor to take out the myProperty from exchange and >> set it into the message header? >> You will get the full control of the exchange and message in that >> processor. >> >> Willem >> >> >> Nasim Anza wrote: >> > Hi, >> > >> > I'm trying to set the URI of an http endpoint using a dynamic property >> but >> > it doesn't work. >> > >> > I've tried the following DSL code: >> > >> > *from("direct:myEndPoint") >> > .setProperty("myProperty").xpath("//MyProperty", String.class) //This >> value >> > is defined in input XML >> > >> .setProperty("uriParameter").constant(MyHelper.getParameterValue("${property.myProperty}")) >> > //The value depends on the previous property value (myProperty) >> > >> .setHeader(org.apache.camel.component.http.HttpProducer.HTTP_URI).simple(" >> > http://myserver?dynamicParam=${property.uriParameter}<http://myserver?dynamicParam=$%7Bproperty.uriParameter%7D> >> ") >> > *.... >> > >> > My URI depends on the dynamicParam which depends on the value of the >> > property "myProperty" set by the user in the SOAP request. >> > >> > The MyHelper is a class that defines a static method "static String >> > getParameterValue(String propertyValue)" which returns a string value >> > depending on a given property value. >> > >> > It seems very simple to do it in java but more complex with Camel DSL! >> > >> > Can someone helps me. >> > >> > Thanks >> > Mustapha >> > >> >> > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus Apache Camel Reference Card: http://refcardz.dzone.com/refcardz/enterprise-integration Interview with me: http://architects.dzone.com/articles/interview-claus-ibsen-about?mz=7893-progress
