I'm trying to understand ws-security signing and encryption. I've followed this guide. As mentioned I've Installed rampart, have created the relevant *.aar
file successfully and deployed it in the tomcat servlet engine, added the org.bouncycastle.jce.provider.BouncyCastleProvider
Bouncy Castle security provider (necessary for the public-key cryptography features used in the example code) to JVM security configuration (the lib/security/java.security
file), added the Bouncy Castle JAR to both Axis2 installation's lib directory and Axis2 server application's WEB-INF/lib
directory. (Which is the setup to run the given sample) But when running the example described, I am getting the following errors
[java] Connecting to http://localhost:8080/axis2/services/library-signencr
[java] Exception in thread "main" org.apache.axis2.AxisFault: SOAP message MUST NOT contain a Document Type Declaration(DTD)
[java] at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
[java] at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
[java] at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
[java] at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
[java] at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
[java] at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
[java] at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
[java] at com.sosnoski.ws.library.adb.LibrarySignencrStub.getBook(LibrarySignencrStub.java:205)
[java] at com.sosnoski.ws.library.adb.WebServiceClient.main(WebServiceClient.java:83)
[java] Caused by: org.apache.axiom.om.OMException: SOAP message MUST NOT contain a Document Type Declaration(DTD)
[java] at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.createDTD(StAXSOAPModelBuilder.java:455)
[java] at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:282)
[java] at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:198)
[java] at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
[java] at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
[java] at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:686)
[java] at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
[java] at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
[java] at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
[java] ... 7 more
[java] Java Result: 1
How could I resolve this issue?