tags:

views:

622

answers:

3

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.

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)
+2  A: 

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 UI to see what is returned from the service.

Superfilin
It returns : HTTP/1.1 200 OKDate: Tue, 10 Nov 2009 12:48:24 GMTServer: ApacheContent-Length: 0Content-Type: text/html
newbie
Then something is wrong with XML it returns. Can you try to check its wellformedness using some tool like XMLSpy?
Superfilin
Oh, actually in your response: "Content-Length: 0". There is no XML at all. I think that's the reason you see SAXParseException. As there is nothing to parse.
Superfilin
I changed invoke to invokeOneWay ,which means it doesn't wait for response at all, but it just doesn't apply my changes to webservice side, but exception goes away, because no xml is returned
newbie
looks like webservice was crashing on the other side when I didn't fill all attributes in soap object
newbie
+1 for SOAP UI. Very handy tool, and thank you for introducing me to it.
Ian McLaird
+1  A: 

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.

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.

Good luck! (I didn't solve my issue..)

Andreas_D
A: 

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.

Ian McLaird