Details
-
Bug
-
Status: Resolved
-
Critical
-
Resolution: Fixed
-
1.1, 1.2, 1.3
-
None
Description
- Issue:
RampartUtil intializes Jaxen XPath incorrectly. While adding the namespaces it's using the namespaces found in soap envelope as opposed to what is defined with XPath expression in sp:XPath element.
This makes XPath expression to fail if targeted message contains different namespace prefixs.
Below is affected code snippet from org.apache.rampart.util.RampartUtil.getPartsAndElements(..)
XPath xp = new AXIOMXPath(expression);
Iterator nsIter = namespaces.iterator();
while (nsIter.hasNext()){
OMNamespace tmpNs = (OMNamespace)nsIter.next();
xp.addNamespace(tmpNs.getPrefix(), tmpNs.getNamespaceURI());
}
Example:
WS-SP policy sample:
<wsp:Policy wsu:Id="InitiatePaymentRequestSignedPolicy">
<sp:SignedElements>
<sp:XPath xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">//S:Envelope/S:Body</sp:XPath>
</sp:SignedElements>
</wsp:Policy>
If soap envelope contains different namespace to "S" then Xpath wont work.
- Possible Solution:
While registering the name spaces in above code snippet, it should also register the name spaces defined in sp:XPath element.