As *always* with xpath, make sure it works first.

For example set it to a header, and then use the camel tracer / log
component etc. to log it.
Also with xpath the result type is usually some XML type. And thus you
need to set it to "String" if you want just text.

There is a resultType on the xpath builder for that. Then you can set
it to String.class.



On Wed, Sep 12, 2012 at 9:33 AM, balkishore <balkishore.pan...@gmail.com> wrote:
> Hi I would like to perform sticky load balncing in apache camel based on the
> SOAP session, whcih is embedded in ServiceGroupID node of the first
> response.
>
> I wrote a small route as follow:
>
> from(uri)
> .loadBalance().sticky(xpath(query).namespaces(env).namespaces(wsa).namespaces(ax))
> .to(BE1,BE2);
>
> Where URI is the string to which the requests are passed and BE1 and BE2 are
> the two backend servers.
>
> And my query is
>
> String query =
> "/soapenv:Envelope/soapenv:Header/wsa:ReplyTo/wsa:ReferenceParameters/axis2:ServiceGroupId/text()";
>
> If i am not wrong this query would extract the servicegroupID from my SOAP
> header.
>
> But when I try to perform the balancing, due to some reason whatsoever, the
> requets are not being passed to the same backend server.
>
> and my env, wsa and ax are the namespaces, which are :
>
> Namespaces env = new Namespaces("soapenv",
> "http://schemas.xmlsoap.org/soap/envelope/";);
> Namespaces wsa = new Namespaces("wsa",
> "http://www.w3.org/2005/08/addressing";);
> Namespaces ax = new Namespaces("axis2",
> "http://ws.apache.org/namespaces/axis2";);
>
> Am I doing something wrong here?
> If so what? I would appreciate any help.
>
>
>
>
> --
> View this message in context: 
> http://camel.465427.n5.nabble.com/Performing-Sticky-load-balancing-in-Camel-tp5719170.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
FuseSource
Email: cib...@fusesource.com
Web: http://fusesource.com
Twitter: davsclaus, fusenews
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen

Reply via email to