axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lior Wehrli (Created) (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AXIS2-5271) NullPointerException when executing XPath expression on DOM Tree in Provider<SOAPMessage>
Date Fri, 16 Mar 2012 15:35:37 GMT
NullPointerException when executing XPath expression on DOM Tree in Provider<SOAPMessage>
-----------------------------------------------------------------------------------------

                 Key: AXIS2-5271
                 URL: https://issues.apache.org/jira/browse/AXIS2-5271
             Project: Axis2
          Issue Type: Bug
          Components: jaxws
    Affects Versions: 1.6.1
         Environment: JBoss 5
            Reporter: Lior Wehrli


Implementing a JAX-WS service using the Provider<SOAPMessage> interface, I would like
to extract elements from the SOAP request using XPath. But when the XPathExpression is executed
on the SOAPPart of the message, a NullPointerException is thrown. I assume that, since SOAPPart
implements a DOM Document, this should work.

Here is an (abstracted) extract of my code:

{code}
public SOAPMessage invoke(SOAPMessage message) {
    XPathFactory factory = XPathFactory.newInstance();
    XPath xpathBuilder = factory.newXPath();
    XPathExpression xpath = xpathBuilder.compile("//OnBehalfOf/UsernameToken/Username/text()");
    Node node = (Node) xpath.evaluate(message.getSOAPPart(), XPathConstants.NODE);
}
{code}

The exception:

{noformat}
Caused by: javax.xml.transform.TransformerException: Unknown error in XPath.
    at org.apache.xpath.XPath.execute(XPath.java:363)
    at org.apache.xpath.XPath.execute(XPath.java:301)
    at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:123)
    at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:97)
    at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:178)
    ... 38 more
Caused by: java.lang.NullPointerException
    at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(DOM2DTM.java:387)
    at org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(DTMDefaultBase.java:563)
    at org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(DTMDefaultBase.java:1140)
    at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$ChildTraverser.next(DTMDefaultBaseTraversers.java:461)
    at org.apache.xpath.axes.AxesWalker.getNextNode(AxesWalker.java:333)
    at org.apache.xpath.axes.AxesWalker.nextNode(AxesWalker.java:361)
    at org.apache.xpath.axes.WalkingIterator.nextNode(WalkingIterator.java:192)
    at org.apache.xpath.axes.NodeSequence.nextNode(NodeSequence.java:281)
    at org.apache.xpath.axes.NodeSequence.runTo(NodeSequence.java:435)
    at org.apache.xpath.axes.NodeSequence.setRoot(NodeSequence.java:218)
    at org.apache.xpath.axes.LocPathIterator.execute(LocPathIterator.java:210)
    at org.apache.xpath.XPath.execute(XPath.java:335)
{noformat}

Seen on Axis2 1.6.1 and JBoss 5


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message