This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Premature end of file thrown from Axis SOAPPart

Apr 25th, 2007, 11:25 AM

I have a simple message coming into the PayloadRootQNameEndpointMapping that is causing an odd exception when the mapping is trying to retrieve the payload source. I've tried it on a few recent versions of Tomcat.

Comment

Well, spring-ws-core doesn't implement SAAJ, nor does it export the SAAJ implementation dependency. We don't want to force a particular implementation of SAAJ, since every app server has it's own impl.

Comment

When I use JaxRpcProxyFactoryBean to consume the webservices using Axis 1.4, I don't see any issue. The moment I started using Spring-ws-rc1, I started getting the following exception. I would appreciate any help here. I tried playing around with jars and I did not see a change in the behaviour.

org.springframework.ws.soap.saaj.SaajSoapEnvelopeE xception: Could not access envelope: org.xml.sax.SAXParseException: Premature end of file.; nested exception is javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Premature end of file.
Caused by: javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.axis.SOAPPart.getEnvelope(SOAPPart.java :1005)
at org.springframework.ws.soap.saaj.Saaj12Implementat ion.getEnvelope(Saaj12Implementation.java:140)
at org.springframework.ws.soap.saaj.SaajSoapMessage.g etEnvelope(SaajSoapMessage.java:84)
at org.springframework.ws.soap.AbstractSoapMessage.ge tSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.ha sFault(AbstractSoapMessage.java:55)
at org.springframework.ws.soap.AbstractSoapMessage.ge tFaultReason(AbstractSoapMessage.java:60)
at org.springframework.ws.client.core.SimpleFaultReso lver.resolveFault(SimpleFaultResolver.java:33)
at org.springframework.ws.client.core.WebServiceTempl ate.sendAndReceive(WebServiceTemplate.java:367)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 215)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 203)
at org.springframework.ws.client.core.WebServiceTempl ate.marshalSendAndReceive(WebServiceTemplate.java: 195)
at gov.fda.furls.fmls.bus.impl.FmlsDocumentDrivenServ iceImpl.doCallFmlsService(FmlsDocumentDrivenServic eImpl.java:104)
at gov.fda.furls.fmls.bus.impl.FmlsDocumentDrivenServ iceImpl.validateAddress(FmlsDocumentDrivenServiceI mpl.java:81)
at gov.fda.furls.fmls.bus.impl.FmlsDocumentDrivenServ iceImplTest.testValidateAddress(FmlsDocumentDriven ServiceImplTest.java:40)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154 )
at junit.framework.TestCase.runBare(TestCase.java:127 )
at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:69)
at junit.framework.TestResult$1.protect(TestResult.ja va:106)
at junit.framework.TestResult.runProtected(TestResult .java:124)
at junit.framework.TestResult.run(TestResult.java:109 )
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:2 08)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:128)
at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.axis.AxisFault.makeFault(AxisFault.java :101)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPar t.java:701)
at org.apache.axis.SOAPPart.getEnvelope(SOAPPart.java :1003)
... 32 more
Caused by: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.xerces.util.ErrorHandlerWrapper.createS AXParseException(Unknown Source)
at org.apache.xerces.util.ErrorHandlerWrapper.fatalEr ror(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
at org.apache.xerces.impl.XMLErrorReporter.reportErro r(Unknown Source)
at org.apache.xerces.impl.XMLVersionDetector.determin eDocVersion(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 org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser .parse(Unknown Source)
at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
at org.apache.axis.encoding.DeserializationContext.pa rse(DeserializationContext.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPar t.java:696)
... 33 more

Comment

I'm having a similar problem, and I've been struggling for a while, now.

I'm using Castor marshalling.

This is the error I get (similar to the Original Poster's):

Code:

javax.xml.soap.SOAPException: org.xml.sax.SAXParseException: Premature end of file.
at org.apache.axis.SOAPPart.getEnvelope(SOAPPart.java:1005)
at org.apache.axis.Message.getSOAPBody(Message.java:555)
at org.springframework.ws.soap.saaj.Saaj12Implementation.getEnvelope(Saaj12Implementation.java:144)
at org.springframework.ws.soap.saaj.SaajSoapMessage.getEnvelope(SaajSoapMessage.java:81)
at org.springframework.ws.soap.AbstractSoapMessage.getSoapBody(AbstractSoapMessage.java:35)
at org.springframework.ws.soap.AbstractSoapMessage.getPayloadSource(AbstractSoapMessage.java:45)
at org.springframework.ws.server.endpoint.mapping.PayloadRootQNameEndpointMapping.resolveQName(PayloadRootQNameEndpointMapping.java:55)
at org.springframework.ws.server.endpoint.mapping.AbstractQNameEndpointMapping.getLookupKeyForMessage(AbstractQNameEndpointMapping.java:32)
at org.springframework.ws.server.endpoint.mapping.AbstractMapBasedEndpointMapping.getEndpointInternal(AbstractMapBasedEndpointMapping.java:105)
at org.springframework.ws.server.endpoint.mapping.AbstractEndpointMapping.getEndpoint(AbstractEndpointMapping.java:82)
at org.springframework.ws.server.MessageDispatcher.getEndpoint(MessageDispatcher.java:237)
at org.springframework.ws.server.MessageDispatcher.dispatch(MessageDispatcher.java:190)
at org.springframework.ws.server.MessageDispatcher.receive(MessageDispatcher.java:157)
at org.springframework.ws.transport.support.WebServiceMessageReceiverObj
....(other lines skipped)
Caused by: 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(SAXParser.java:375)
at org.apache.axis.encoding.DeserializationContext.parse(Deserialization Context.java:227)
at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:696)
... 40 more

I'm using a local test client, and using a request filter, I see that the following information is arriving: