java apache axis2 com.ctc.wstx.exc.WstxUnexpectedCharException 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14331959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 15:54:13  来源:igfitidea点击:

apache axis2 com.ctc.wstx.exc.WstxUnexpectedCharException error

javaaxis2

提问by Martin

I working on a web service using apache axis2, I have generated client stub code from wsdlfile how when I call the web service I'm getting this error:

我使用 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

Any idea on what could wrong with my code?

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

回答by dosakiller

Check for the address and port in the endpoint in the wsdl.

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

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

Generate the client again and try calling the web service.

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

回答by BlueMoon93

Which encoding are you using and what encoding is on your received text? wstx expects the character to be a valid IsoControl charactersuggests you're using ISO in your system and maybe receiving UTF-8 or some other incompatible encoding. Make sure encodings match and there should be no problem.

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