java Axis 1.4 AxisFault 文件过早结束
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1707491/
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
Axis 1.4 AxisFault Premature end of file
提问by newbie
I get this error when I use my autogenerated ServiceBindingStub.java. WebService side is working ok, so this error must be in code, but code is autogenerated, so I cannot know why it doesn't work. Some other calls work fine, but this doesn't. This call included updating, while other working calls are just fetching data from WebService.
使用自动生成的 ServiceBindingStub.java 时出现此错误。WebService 端工作正常,所以这个错误必须在代码中,但代码是自动生成的,所以我不知道为什么它不起作用。其他一些调用可以正常工作,但这不行。这个调用包括更新,而其他工作调用只是从 WebService 获取数据。
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
faultSubcode:
faultString: org.xml.sax.SAXParseException: Premature end of file.
faultActor:
faultNode:
faultDetail:
{http://xml.apache.org/axis/}stackTrace:org.xml.sax.SAXParseException: Premature end of file.
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.XMLVersionDetector.determineDocVersion(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at javax.xml.parsers.SAXParser.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)
回答by Andrey Adamovich
This happens when service you are connecting to does not return SOAP response, but some text or HTML. Try opening the URL in the browser or use some SOAP debugger like SOAP UIto see what is returned from the service.
当您连接的服务不返回 SOAP 响应,而是返回一些文本或 HTML 时,就会发生这种情况。尝试在浏览器中打开 URL 或使用一些 SOAP 调试器(如SOAP UI)来查看从服务返回的内容。
回答by Andreas Dolk
I once had the same problem. In my case, I received messages with 'binary data' between tags (imagery). Axis used a fixed size buffer to read the data, once the buffer was full it just proceeded and ran out of sync.
我曾经遇到过同样的问题。就我而言,我在标签(图像)之间收到了带有“二进制数据”的消息。Axis 使用固定大小的缓冲区来读取数据,一旦缓冲区已满,它就会继续运行并失去同步。
In fact, you should be able to find the tag or part in the xml file by debugging the stub code step by step. No guarantee, that the issue will can be solved easily but it might give you a hint that the (a) stub is not generated correctly or (b) the xml file is just not well-formed or valid against the schema that has been used to generate the stub.
实际上,通过逐步调试存根代码,您应该可以找到xml文件中的标记或部分。不保证,该问题可以轻松解决,但它可能会提示您 (a) 存根未正确生成或 (b) xml 文件格式不正确或对已使用的架构有效生成存根。
Good luck! (I didn't solve my issue..)
祝你好运!(我没有解决我的问题..)
回答by Ian McLaird
I just had (and solved) this problem, following Superfilin's answer. In the end, the problem turned out to be that I hadn't added a <beanMapping>for one of the classes I was returning in my deployment.wsdd file. Any time the response would have included that class, I'd get a completely empty message body instead.
按照 Superfilin 的回答,我刚刚(并解决了)这个问题。最后,问题是我没有<beanMapping>为我在 deployment.wsdd 文件中返回的类之一添加一个。每当响应包含该类时,我都会得到一个完全空的消息正文。
回答by user1631072
Even we have faced the same issue. But there are some special characters in the content. We removed those special characters and it worked fine.
甚至我们也面临着同样的问题。但内容中有一些特殊字符。我们删除了那些特殊字符,效果很好。

