camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gert-Jan van de Streek <g.j.str...@avisi.nl>
Subject Re: How to get a dynamic property with Camel DSL
Date Wed, 13 May 2009 09:51:13 GMT

What is the part that isn't working? I don't know what your MyHelper  
class is exactly doing, but if it really does return a value, your  
code should work.

You can use HttpProducer.QUERY instead of setting the complete url:

                 .setHeader(HttpProducer.QUERY, new  
SimpleExpression("dynamicParam=${property.uriParameter}"))
                 .to("http://myserver")


On 13 mei 2009, at 11:21, 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}")
> *....
>
> 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


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message