axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lior Wehrli (Created) (JIRA)" <>
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
             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:

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

The exception:

Caused by: javax.xml.transform.TransformerException: Unknown error in XPath.
    at org.apache.xpath.XPath.execute(
    at org.apache.xpath.XPath.execute(
    at org.apache.xpath.jaxp.XPathExpressionImpl.eval(
    at org.apache.xpath.jaxp.XPathExpressionImpl.eval(
    at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(
    ... 38 more
Caused by: java.lang.NullPointerException
    at org.apache.xml.dtm.ref.dom2dtm.DOM2DTM.nextNode(
    at org.apache.xml.dtm.ref.DTMDefaultBase._nextsib(
    at org.apache.xml.dtm.ref.DTMDefaultBase.getNextSibling(
    at org.apache.xml.dtm.ref.DTMDefaultBaseTraversers$
    at org.apache.xpath.axes.AxesWalker.getNextNode(
    at org.apache.xpath.axes.AxesWalker.nextNode(
    at org.apache.xpath.axes.WalkingIterator.nextNode(
    at org.apache.xpath.axes.NodeSequence.nextNode(
    at org.apache.xpath.axes.NodeSequence.runTo(
    at org.apache.xpath.axes.NodeSequence.setRoot(
    at org.apache.xpath.axes.LocPathIterator.execute(
    at org.apache.xpath.XPath.execute(

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:!default.jspa
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message