Hi,
I was try to sign the following SOAP Message using WSS4J 1.5.1
library, but the WSSecurityUtil.findElement is throwing a
NullPointerException while try to retrieve the Body element from the
Envelope. Following is the SOAP message I am sending
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<soapenv:Envelope
xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">
<soapenv:Body>
<mesa:mesaAuth
xmlns:mesa=\"http://www.sterlingcommerce.com/mesa\">
<principal>admin</principal>
<auth hashType=\"NONE\">password</auth>
</mesa:mesaAuth>
<mesa:LightweightJDBCAdapterQuery
xmlns:mesa=\"http://www.sterlingcommerce.com/mesa\">
<mesa:sql>SELECT * FROM MBX_MAILBOX</mesa:sql>
<mesa:pool>mysqlPool</mesa:pool>
<mesa:result_name>result</mesa:result_name>
<mesa:row_name>row</mesa:row_name>
<mesa:query_type>SELECT</mesa:query_type>
</mesa:LightweightJDBCAdapterQuery>
</soapenv:Body>
</soapenv:Envelope>
I am using the xalan-2.7.0.jar and xerces-2.7.1 jar. I try to do a unit
test of this method using the following code snippet, but still getting
the NullPointerException:
DocumentBuilder soapDocumentBuilder =
DocumentBuilderFactory.newInstance().newDocumentBuilder();
Document soapEnvelope = soapDocumentBuilder.parse(new
ByteArrayInputStream(SOAP_MESSAGE.getBytes()));
Element envelope = soapEnvelope.getDocumentElement();
Node node =
WSSecurityUtil.findElement(envelope,"Body","http://schemas.xmlsoap.org/s
oap/envelope/");
System.out.println("Find node with name:"+ node.getLocalName());
Is it a bug or I am doing something wrong here? Any help will be highly
solicited.
regards
Abanindra