okay, I've looked into the QueryRP implementation, and here's what I've 
found:

1. The WSRP doc that the XPath query is executed against is all Elements - 
I expected this given that the WSRP doc is retrieved using 
GetResourcePropertyDocument(), which uses XmlUtils.getElement*() methods 
to ensure that it only accesses DOM Element objects (we'd see 
ClassCastExceptions if this weren't the case).

2. Even if your XPath were off, and it was matching empty text nodes, 
there aren't any text nodes to match *at the time of the query*.

3. There are empty text nodes by the time you receive the message on the 
client.

This led me to guess that the empty nodes were inserted either by the 
DOM-to-Axiom conversion (Axis2 uses Axiom for all of its XML/SOAP 
manipulation). My tests show that this is the case - for every element in 
a DOM (including the root), a text node is added. The class that is 
converting the XML to Axiom is 
org.apache.axiom.om.impl.builder.StAXOMBuilder.

I'm not really sure what to do about this. I guess I could update the 
AxisEnvironment.convertToAxiom() method to look through the SOAP message 
and delete all empty text nodes. I'm not sure what a full tree search 
would do to performance, and we're already taking a hit in the DOM -> 
Axiom conversion, so let's try to avoid this for now.

So, two workarounds, depending on your scenario:

1. Add a client-side check to make sure your Nodes are indeed Elements.

or 

2. Try using the -mini flag from wsdl2java to get the Mini SOAP engine. 
It's a simple SOAP servlet that doesn't do any XML conversion before 
putting your response on the wire. It's meant to be for J2ME users, but 
it'll work on J2SE as well.



Christian Ewers <[EMAIL PROTECTED]> wrote on 01/31/2007 03:53:33 AM:

> 
> Hi,
> the nodes text is just a string of blanks.
> 
> I call these mothods for each node:
> System.out.println((i++)+"
> \n"+node.getNodeName()+"\n"+XmlUtils.toString(node));
> System.out.println("##"+node.getNodeValue()+"##");
> 
> 
> 
> 0
> #text
> 
> 
> ##
>             ##
> 1
> wsrf-sg:MemberServiceEPR
> <?xml version="1.0" encoding="UTF-8"?>
> <wsrf-sg:MemberServiceEPR
> xmlns:wsrf-sg="http://docs.oasis-open.org/wsrf/sg-2";>
>     <wsa:Address
> xmlns:wsa="http://www.w3.org/2005/08/addressing";>http://localhost:
> 8080/DefaultService/services/PAIResource</wsa:Address>
>     <wsa:ReferenceParameters
> xmlns:wsa="http://www.w3.org/2005/08/addressing";>
>         <muse-wsa:ResourceId
> 
xmlns:muse-wsa="http://ws.apache.org/muse/addressing";>uuid:c024ffdd-eb1a-
> f923-6faf-9cfaa551ec55</muse-wsa:ResourceId>
>     </wsa:ReferenceParameters>
> </wsrf-sg:MemberServiceEPR>
> 
> ##null##
> 2
> #text
> 
> 
> ##
>         ##
> 
> 
> 
> Dienstag, 30. Januar 2007 16:22
> To: [email protected]
> cc:
> From: Daniel Jemiolo <[EMAIL PROTECTED]>
> Subject: Re: Empty nodes as result of queryResourceProperties()
> 
> 
> hmmm. I'm not an XPath expert, but it looks like a bug. What do the text
> nodes say? (can you send the values from getNodeValue()?)
> 
> 
> 
> Christian Ewers <[EMAIL PROTECTED]> wrote on 01/30/2007 10:07:57 AM:
> 
> >
> > Hi,
> >
> > I'm using the queryResourceProperties() method to get idle resources
> from a
> > ServiceGroup.
> > My xpath-query  is: (sg is the ServiceGroupClient)
> >
> > Node[] eprs =
> >
> 
sg.queryResourceProperties("/wsrf-sg:ServiceGroupRP/wsrf-sg:Entry[./wsrf-sg:
> > Content/muws2:OperationalStatus
> >  =
> >
> 
'Available']/wsrf-sg:MemberServiceEPR[contains(./wsa:Address,'WSResource')]",
> >  "http://www.w3.org/TR/1999/REC-xpath-19991116";);
> >
> >
> > When their aren't any resources availaibe, the result is an correct
> empty
> > node-array. When there are available resources I get them but I get
> > additional "#text"-nodes for each "real" result.
> > For example, when I have one idle resource I get the following result
> for
> > the following loop
> >
> > for (Node node : eprs) {
> >       System.out.println((i++)+"
> > \n"+node.getNodeName()+"\n"+XmlUtils.toString(node));
> > }
> >
> > ----- log-----
> > 0
> > #text
> >
> >
> > 1
> > wsrf-sg:MemberServiceEPR
> > <?xml version="1.0" encoding="UTF-8"?>
> > <wsrf-sg:MemberServiceEPR
> > xmlns:wsrf-sg="http://docs.oasis-open.org/wsrf/sg-2";>
> >     <wsa:Address
> > xmlns:wsa="http://www.w3.org/2005/08/addressing";>http://localhost:
> > 8080/DefaultService/services/PAIResource</wsa:Address>
> >     <wsa:ReferenceParameters
> > xmlns:wsa="http://www.w3.org/2005/08/addressing";>
> >         <muse-wsa:ResourceId
> > xmlns:muse-wsa="http://ws.apache.org/muse/addressing";>uuid:701e1d9b-
> > fb93-93fc-6242-20de49fa9fba</muse-wsa:ResourceId>
> >     </wsa:ReferenceParameters>
> > </wsrf-sg:MemberServiceEPR>
> >
> > 2
> > #text
> > ------end log------
> >
> > Does my query result in some empty elements, or is this a bug?
> >
> > Regards,
> > Christian
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to