You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by balkishore <ba...@gmail.com> on 2012/09/11 15:24:37 UTC

Using more than one namespace and calling it in Xpath.

I would like to create more than one name, something like this:

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");

and would like to use it on the xpath expression in route, something like
this:

.loadBalance().sticky(xpath("/soapenv:Envelope/soapenv:Header/wsa:ReplyTo/wsa:ReferenceParameters/axis2:ServiceGroupId/text()")
, env, wsa, ax)

But when I try to use it, I get an error as

The method xpath(String) in the type BuilderSupport is not applicable for
the arguments 
	 (String, Namespaces, Namespaces, Namespaces)
	 
What I am doing here is parsing the ServiceGroupID element from my SOAP
header, which contians the session of the transcation and performing a
sticky
load balancing session based on the session.

Is what I am doing right? If not are there any other ways to get this
element from SOAP Header? 
I gave a look at CXF component but didn't understand any thing out of it.

My SOAP Response message looks something like this:

<?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"
standalone="no"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
<wsa:ReplyTo>
<wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
<wsa:ReferenceParameters>
<axis2:ServiceGroupId
xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:99A029EBBC70DBEB221347349722532</axis2:ServiceGroupId>
</wsa:ReferenceParameters>
</wsa:ReplyTo>
<wsa:MessageID>urn:uuid:99A029EBBC70DBEB221347349722564</wsa:MessageID>
<wsa:Action>some action to perform</wsa:Action>
<wsa:RelatesTo>urn:uuid:63AD67826AA44DAE8C1347349721356</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
something in the body
</soapenv:Body>
</soapenv:Envelope>

I would be really glad if anyone could help me here.
I am struck in this part for quite a while now.




--
View this message in context: http://camel.465427.n5.nabble.com/Using-more-than-one-namespace-and-calling-it-in-Xpath-tp5719120.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using more than one namespace and calling it in Xpath.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

You can use Camel tracer
http://camel.apache.org/tracer



On Tue, Sep 11, 2012 at 3:50 PM, balkishore <ba...@gmail.com> wrote:
> Hello
>
> Thanks a ton for replying.
> It worked.
> But Is there any tool that could help me trace the routes.
> As I am working on a load balncer, I would like to know which of the backend
> servers recieves the request.
> I have a client which would send request to camel, with the help of jetty
> and would load balance the request to the backend servers.
> So there a tool that would help me view these transactions, or can I lod
> these details, if so how? and where would my log file gets saved?
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-more-than-one-namespace-and-calling-it-in-Xpath-tp5719120p5719125.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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

Re: Using more than one namespace and calling it in Xpath.

Posted by balkishore <ba...@gmail.com>.
Hello

Thanks a ton for replying.
It worked.
But Is there any tool that could help me trace the routes.
As I am working on a load balncer, I would like to know which of the backend
servers recieves the request.
I have a client which would send request to camel, with the help of jetty
and would load balance the request to the backend servers.
So there a tool that would help me view these transactions, or can I lod
these details, if so how? and where would my log file gets saved?



--
View this message in context: http://camel.465427.n5.nabble.com/Using-more-than-one-namespace-and-calling-it-in-Xpath-tp5719120p5719125.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Using more than one namespace and calling it in Xpath.

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

I am pretty sure there is a builder for multiple namespaces.
Also there is often additonal methods on itself:

xpath("bla bla").namespace(ns1).namespace(ns2) etc

I dont have my editor open, but look around. It should be doable from Java code.

On Tue, Sep 11, 2012 at 3:24 PM, balkishore <ba...@gmail.com> wrote:
> I would like to create more than one name, something like this:
>
> 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");
>
> and would like to use it on the xpath expression in route, something like
> this:
>
> .loadBalance().sticky(xpath("/soapenv:Envelope/soapenv:Header/wsa:ReplyTo/wsa:ReferenceParameters/axis2:ServiceGroupId/text()")
> , env, wsa, ax)
>
> But when I try to use it, I get an error as
>
> The method xpath(String) in the type BuilderSupport is not applicable for
> the arguments
>          (String, Namespaces, Namespaces, Namespaces)
>
> What I am doing here is parsing the ServiceGroupID element from my SOAP
> header, which contians the session of the transcation and performing a
> sticky
> load balancing session based on the session.
>
> Is what I am doing right? If not are there any other ways to get this
> element from SOAP Header?
> I gave a look at CXF component but didn't understand any thing out of it.
>
> My SOAP Response message looks something like this:
>
> <?xml version="1.0" encoding="http://schemas.xmlsoap.org/soap/envelope/"
> standalone="no"?>
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
> <wsa:ReplyTo>
> <wsa:Address>http://www.w3.org/2005/08/addressing/none</wsa:Address>
> <wsa:ReferenceParameters>
> <axis2:ServiceGroupId
> xmlns:axis2="http://ws.apache.org/namespaces/axis2">urn:uuid:99A029EBBC70DBEB221347349722532</axis2:ServiceGroupId>
> </wsa:ReferenceParameters>
> </wsa:ReplyTo>
> <wsa:MessageID>urn:uuid:99A029EBBC70DBEB221347349722564</wsa:MessageID>
> <wsa:Action>some action to perform</wsa:Action>
> <wsa:RelatesTo>urn:uuid:63AD67826AA44DAE8C1347349721356</wsa:RelatesTo>
> </soapenv:Header>
> <soapenv:Body>
> something in the body
> </soapenv:Body>
> </soapenv:Envelope>
>
> I would be really glad if anyone could help me here.
> I am struck in this part for quite a while now.
>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Using-more-than-one-namespace-and-calling-it-in-Xpath-tp5719120.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



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