users@wadl.java.net

SAXParseException with JAXBDispatcher doPost

From: Guillaume Lebleu <guillaume_at_lebleu.org>
Date: Thu, 14 May 2009 11:58:13 -0700

Hello,

I have a method in my generated Endpoint.java that takes a JAXB object
in, and returns void (resource creation via HTTP POST). In the WADL, I
have no <response> for the corresponding HTTP method, only a <request>.

In my resource server implementation, I return a Response via
Response.created(someresourcelocation).build();

This results in the exception below. The TCP/IP monitor shows that the
request is properly marshalled, received and the service properly
responds, the issue is the processing of the response on the client end.

My only workaround so far is to echo the received entity in the POST
response via Response.created(...).entity(...).build(), but I'd like
to avoid doing so.

Thank you in advance for any suggestion,

Guillaume

---
javax.xml.bind.UnmarshalException
- with linked exception:
[org.xml.sax.SAXParseException: Premature end of file.]
	at  
javax 
.xml 
.bind 
.helpers 
.AbstractUnmarshallerImpl 
.createUnmarshalException(AbstractUnmarshallerImpl.java:315)
	at  
com 
.sun 
.xml 
.bind 
.v2 
.runtime 
.unmarshaller 
.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:514)
	at  
com 
.sun 
.xml 
.bind 
.v2 
.runtime 
.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:215)
	at  
com 
.sun 
.xml 
.bind 
.v2 
.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java: 
184)
	at  
javax 
.xml 
.bind 
.helpers 
.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:137)
	at  
javax 
.xml 
.bind 
.helpers 
.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:184)
	at org.jvnet.ws.wadl.util.JAXBDispatcher.doPOST(JAXBDispatcher.java: 
158)
	at com.example.svc.client.Endpoint$Msgs.postAsvoid(Endpoint.java:338)
	at  
com 
.example.svc.client.tests.TestEndpoint.testPostMsg(TestEndpoint.java:63)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at  
sun 
.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 
39)
	at  
sun 
.reflect 
.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 
25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at junit.framework.TestCase.runTest(TestCase.java:168)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:110)
	at junit.framework.TestResult.runProtected(TestResult.java:128)
	at junit.framework.TestResult.run(TestResult.java:113)
	at junit.framework.TestCase.run(TestCase.java:124)
	at junit.framework.TestSuite.runTest(TestSuite.java:232)
	at junit.framework.TestSuite.run(TestSuite.java:227)
	at  
org 
.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java: 
91)
	at  
org 
.eclipse 
.jdt 
.internal 
.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at  
org 
.eclipse 
.jdt 
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 
460)
	at  
org 
.eclipse 
.jdt 
.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java: 
673)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java: 
386)
	at  
org 
.eclipse 
.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java: 
196)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal 
.util 
.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java: 
236)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java: 
215)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:386)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal 
.impl.XMLVersionDetector.determineDocVersion(XMLVersionDetector.java: 
230)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.parsers.XML11Configuration.parse(XML11Configuration.java:798)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at  
com 
.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java: 
148)
	at  
com 
.sun 
.org 
.apache 
.xerces 
.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
	at  
com 
.sun 
.xml 
.bind 
.v2 
.runtime 
.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:211)
	... 25 more