2013-12-12 107 views
4

我試圖瞭解ws-security簽名和加密。我遵循this指南。正如前面提到的我已經安裝了壘,已經成功創建了相關的*.aar文件,並將其部署到tomcat servlet引擎中,並將Bouncy Castle安全提供程序(對示例代碼中使用的公鑰加密功能必需的)org.bouncycastle.jce.provider.BouncyCastleProvider添加到JVM安全配置(lib/security/java.security文件),將Bouncy Castle JAR添加到Axis2安裝的lib目錄和Axis2服務器應用程序的目錄WEB-INF/lib中。 (這是運行在給定的樣本設置),但在運行中描述的例子時,我收到以下錯誤SOAP消息不得包含文檔類型聲明(DTD)

[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 

我怎麼能解決這個問題?

+0

而當你打開此http://本地主機:8080 /的Axis2 /服務/在瀏覽器鏈接,什麼你有看到? – divanov

回答

7

我有一個webservice,一直工作,但昨天同樣的問題。由於在代碼中,我們等待一個XML響應,但它給了一個html錯誤頁面,所以問題就出來了。所以DOCUMENT TYPE(html頁面)不是我們在代碼中所期望的。而這一切都是因爲服務器搬走了!

對不起,我回答這麼晚了,但我希望我的回答可以幫助其他人在未來的^ -^

相關問題