javax.xml.stream.XMLStreamException:不允许使用DOCTYPE

时间:2015-12-15 06:28:28

标签: java web-services spring-mvc axis2

我在使用Axis2调用.net Web服务时遇到此异常。请帮我找出解决方案。

org.apache.axis2.AxisFault: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axis2.AxisFault.makeFault(AxisFault.java:430)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:123)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.cakemarketing.affiliates.api._2.ReportsStub.clicks(ReportsStub.java:2106)
at com.infotop.common.Test.main(Test.java:49)

Caused by: org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:276)
at org.apache.axiom.om.impl.llom.OMContainerHelper.buildNext(OMContainerHelper.java:164)
at org.apache.axiom.om.impl.llom.OMContainerHelper.getFirstOMChild(OMContainerHelper.java:182)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getFirstOMChild(OMDocumentImpl.java:201)
at org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:98)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:544)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:540)
at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:188)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
... 7 more
Caused by: javax.xml.stream.XMLStreamException: DOCTYPE is not allowed
at org.apache.axiom.util.stax.dialect.DisallowDoctypeDeclStreamReaderWrapper.next(DisallowDoctypeDeclStreamReaderWrapper.java:36)
at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
at org.apache.axiom.util.stax.dialect.SJSXPStreamReaderWrapper.next(SJSXPStreamReaderWrapper.java:138)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:651)
at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:189)
... 16 more

1 个答案:

答案 0 :(得分:5)

当来自服务器的响应包含SOAP中不允许的文档类型声明时,将触发该异常。这通常意味着服务器生成了HTML错误页面而不是SOAP响应。