XPath-Query 1.0 throws NullPointerException

Document ID : KB000006435
Last Modified Date : 14/02/2018
Show Technical Document Details
Issue:

The XPath-Query 1.0 throws NullPointerException if the Path Expression "namespace-uri" cannot be identified in the XML document.

Please see example Assertion:

xpath.png

The Policy aborts and the Gateway returns a message like the following example:

<?xml version="1.0" encoding="UTF-8"?> 

<soapenv:Envelope 

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 

xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" 

xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

<soapenv:Body> 

<soapenv:Fault> 

<faultcode>Server</faultcode> 

<faultstring>java.lang.NullPointerException</faultstring> 

<faultactor/> 

<detail/> 

</soapenv:Fault> 

</soapenv:Body> 

 

 

Cause:

The seen behavior is based on the XPath 1.0 error handling and is expected.

Resolution:

The error handling of XPath has been enhanced in version 2.0.

XPath 2.0 don't throw a NullPointerException and don't abort the Policy, if the Path Expression "namespace-uri" cannot be identified in the XML document.

Select Version 2.0 on the Evaluate Request XPath Assertion in order to prevent the Policy to abort.