Axis1.4 WebService客户端获取数据遇到的一个错误

Axis1.4已经是很老的版本了,但是没办法,别人的Webservice是用这个发布的。在使用的过程中,遇到了一个错误,先把错误栈贴出来吧。

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 172033; XML document structures must start and end within the same entity.
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 172033; XML document structures must start and end within the same entity.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipChar(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.sendi.logAudit.job.dataws.service.venus4AService.Venus4AServiceSoapBindingStub.resource4AOperContent(Venus4AServiceSoapBindingStub.java:548)
        at com.sendi.logAudit.job.dataws.client.process.Slave4AAppLogGetProcess.process(Slave4AAppLogGetProcess.java:73)
        at com.sendi.logAudit.job.dataws.web.JobTestAction$1.run(JobTestAction.java:48)

        {http://xml.apache.org/axis/}hostname:logaudit48

org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 172033; XML document structures must start and end within the same entity.
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:101)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:701)
        at org.apache.axis.Message.getSOAPEnvelope(Message.java:435)
        at org.apache.axis.handlers.soap.MustUnderstandChecker.invoke(MustUnderstandChecker.java:62)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:206)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
        at org.apache.axis.client.Call.invoke(Call.java:2767)
        at org.apache.axis.client.Call.invoke(Call.java:2443)
        at org.apache.axis.client.Call.invoke(Call.java:2366)
        at org.apache.axis.client.Call.invoke(Call.java:1812)
        at com.sendi.logAudit.job.dataws.service.venus4AService.Venus4AServiceSoapBindingStub.resource4AOperContent(Venus4AServiceSoapBindingStub.java:548)
        at com.sendi.logAudit.job.dataws.client.process.Slave4AAppLogGetProcess.process(Slave4AAppLogGetProcess.java:73)
        at com.sendi.logAudit.job.dataws.web.JobTestAction$1.run(JobTestAction.java:48)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 172033; XML document structures must start and end within the same entity.
        at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
        at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
        at org.apache.xerces.impl.XMLScanner.reportFatalError(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentScannerImpl.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityManager.endEntity(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.load(Unknown Source)
        at org.apache.xerces.impl.XMLEntityScanner.skipChar(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
        at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.DTDConfiguration.parse(Unknown Source)
        at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
        at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
        at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
        at org.apache.axis.encoding.DeserializationContext.parse(DeserializationContext.java:227)
        at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
        ... 11 more

我是一个小时获取一次数据,有的时候成功,有的时候失败,失败的情况下一般就是打印这个问题了。很纳闷,由于传递的请求参数是一样的,为什么有几个小时的数据就是传递失败呢。后来还是用Google解决了这个问题。

stackoverflow上面的原话是这么说的。

 Axis 1.4 knows nothing about chunks in the HTTP response and probably closes the connection before receiving all the chunks. When it attempts to deserialize the SOAP message, it complains that the XML is not well formed and is missing some closing tag, which is expected because it doesn't have the complete SOAP response.

意思是Axis1.4 用的是HTTP1.0来传递数据,不支持分块传输编码(这个我也不懂:(),可能在接收到所有的块之前关闭掉这个链接。当反序列话返回的SOAP消息的时候,会抛出XMML格式非法或者某些标签未关闭的异常,原因是没有接收到完整的SOAP响应消息。

解决方案如下

Axis1.4 WebService客户端获取数据遇到的一个错误_第1张图片

修改axis.jar文件里的org/apache/axis/client/client-config.wsdd文件




 

  

  

 

 

 

 

将里面的内容替换成上面的就OK了,这样客户端就能通过http1.1来传递参数了。

原始地址是 http://stackoverflow.com/questions/7306626/saxparseexception-xml-document-structures-must-start-and-end-within-the-same-en

你可能感兴趣的:(JAVAWEB,webservice,soap,axis)