Hello,
I'm using CXF through the JAX-WS Provider interface. I set the
parametric parameter of the interface to javax.xml.transform.Source.
I don't use the SEI approach because I need to handle messages with
very complex Schema Documents (http://schemas.opengis.net).
All works well if I return from the method "invoke" an object of type
DOMSource, but when I return a JAXBSource object
I receive an error like this:
26-gen-2009 15.50.14 org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Exception occurred while marshalling
Dispatch object to stream
at org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor
$
PostDispatchOutLogicalHandlerInterceptor
.handleMessage(DispatchOutDatabindingInterceptor.java:334)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at
org
.apache
.cxf
.interceptor
.OutgoingChainInterceptor.handleMessage(OutgoingChainInterceptor.java:
74)
at
org
.apache
.cxf
.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at
org
.apache
.cxf
.transport
.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:78)
at
org
.apache
.cxf
.transport.servlet.ServletDestination.invoke(ServletDestination.java:92)
at
org
.apache
.cxf
.transport
.servlet.ServletController.invokeDestination(ServletController.java:285)
at
org
.apache
.cxf.transport.servlet.ServletController.invoke(ServletController.java:
168)
at
org
.apache
.cxf
.transport.servlet.AbstractCXFServlet.invoke(AbstractCXFServlet.java:
175)
at
org
.apache
.cxf
.transport.servlet.AbstractCXFServlet.doPost(AbstractCXFServlet.java:
153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
502)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:365)
at
org
.mortbay
.jetty
.security
.ConstraintsSecurityHandler.handle(ConstraintsSecurityHandler.java:220)
at
org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:822)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:
305)
at
org
.mortbay
.jetty
.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:
229)
at
org
.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:
113)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:
550)
at org.mortbay.jetty.HttpConnection
$RequestHandler.content(HttpConnection.java:890)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:743)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:215)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:407)
at
org
.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:
421)
at org.mortbay.thread.QueuedThreadPool
$PoolThread.run(QueuedThreadPool.java:520)
Caused by: java.lang.RuntimeException: Couldn't parse stream.
at
org
.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:
818)
at
org
.apache
.cxf.databinding.source.NodeDataWriter.write(NodeDataWriter.java:59)
at
org
.apache
.cxf.databinding.source.NodeDataWriter.write(NodeDataWriter.java:43)
at org.apache.cxf.jaxws.interceptors.DispatchOutDatabindingInterceptor
$
PostDispatchOutLogicalHandlerInterceptor
.handleMessage(DispatchOutDatabindingInterceptor.java:332)
... 28 more
Caused by: javax.xml.stream.XMLStreamException: Can not create StAX
reader for the Source passed -- neither reader, input stream nor
system id was accessible; can not use other types of sources (like
embedded SAX streams)
at com.ctc.wstx.stax.WstxInputFactory.createSR(WstxInputFactory.java:
768)
at
com
.ctc
.wstx
.stax.WstxInputFactory.createXMLStreamReader(WstxInputFactory.java:341)
at
org
.apache.cxf.staxutils.StaxUtils.createXMLStreamReader(StaxUtils.java:
816)
... 31 more
So, how can I return a response from a JAXB environment? Should i
transform every JAXB message to DOM and then to DOMSource ?
Thank in advance for your attention!
Valerio
--
Valerio Angelini
Istituto di Metodologie per l'Analisi Ambientale
del Consiglio Nazionale delle Ricerche
tel: +39 0574 602535
e-mail: [email protected]