3

我使用 apache 处理 Web 服务axis2,我从wsdl文件中生成了客户端存根代码,当我调用 Web 服务时,我收到了这个错误:

org.apache.axis2.AxisFault: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
 at [row,col {unknown-source}]: [1,50]
    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 org.csapi.www.wsdl.parlayx.sms.notification_manager.v2_3.service.SmsNotificationManagerServiceStub.startSmsNotification(SmsNotificationManagerServiceStub.java:618)
    at org.csapi.www.wsdl.parlayx.sms.notification_manager.v2_3.service.Notification.startNotification(Notification.java:118)
    at org.csapi.www.wsdl.parlayx.sms.notification_manager.v2_3.service.Notification.main(Notification.java:39)
Caused by: org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
 at [row,col {unknown-source}]: [1,50]
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:296)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.getSOAPEnvelope(StAXSOAPModelBuilder.java:198)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:154)
    at org.apache.axiom.soap.impl.builder.StAXSOAPModelBuilder.<init>(StAXSOAPModelBuilder.java:140)
    at org.apache.axis2.builder.BuilderUtil.getSOAPBuilder(BuilderUtil.java:686)
    at org.apache.axis2.transport.TransportUtils.createDocumentElement(TransportUtils.java:197)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:145)
    at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:108)
    ... 8 more
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '"' (code 34) in DOCTYPE declaration; expected a space between public and system identifiers
 at [row,col {unknown-source}]: [1,50]I working on a web service using apache axis2, i have generated client stub code from wsdl file how when i call the web service i'm getting this error:
    at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:648)
    at com.ctc.wstx.sr.BasicStreamReader.startDTD(BasicStreamReader.java:2482)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromPrologBang(BasicStreamReader.java:2398)
    at com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:2058)
    at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1069)
    at org.apache.axiom.util.stax.wrapper.XMLStreamReaderWrapper.next(XMLStreamReaderWrapper.java:225)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:668)
    at org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:214)
    ... 15 more

知道我的代码有什么问题吗?

4

2 回答 2

1

检查 wsdl 中端点中的地址和端口。

<wsdl:port binding="" name="">
  <soap:address location=""/>
</wsdl:port>

再次生成客户端并尝试调用 Web 服务。

于 2013-01-15T06:27:25.700 回答
1

您使用的是哪种编码,收到的文本是什么编码?wstx expects the character to be a valid IsoControl character建议您在系统中使用 ISO,并且可能会接收 UTF-8 或其他一些不兼容的编码。确保编码匹配,应该没有问题。

于 2016-01-21T11:53:45.040 回答