users@jax-ws.java.net

SAAJ issue

From: Peter Hendry <peter.hendry_at_capeclear.com>
Date: Tue, 07 Mar 2006 22:31:00 +1300

I'm guessing there may be somewhere more appropriate for this comment so
a pointer would be appreciated.

While debugging a SAAJ related problem I ended up in the latest SAAJ API
source code and I noticed that SAAJResult defines the code

    public javax.xml.soap.Node getResult() {
        return (javax.xml.soap.Node)super.getNode().getFirstChild();
    }

Note that this uses the org.w3c.dom.Node.getFirstChild() method to
retrieve a SAAJ Node. From my understanding of section 2.1 of the SAAJ
V1.2 specification (which I assume will also be the case in V1.3), my
understanding is that using the DOM API one can't assume the result will
be a SAAJ Node. It is only once SAAJ API calls have been made on the
tree that it is guaranteed the nodes returned will be SAAJ nodes (and
then only when using SAAJ API calls).

In the above code I suspect there is no guarantee that the returned node
is a SAAJ node rather than a plain DOM Node (except perhaps in the
reference implementation).

The code should perhaps be

    return
(javax.xml.soap.Node)((SOAPElement)super.getNode()).getChildElements().next();

Pete