Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-352

Full streaming WebServiceMessage/SoapMessage

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0 RC1
    • Component/s: Core
    • Labels:
      None

      Description

      Currently, WebServiceMessage and its subinterface SoapMessage offer the getSource() and getResult() methods to the contents of the payload. When an endpoint is invoked, the response Source it returns is transormed into the Result of the response message. This transformation has the benefit that the message is always in sync, i.e. the writeTo() method will write the current contents of the message. The downside is that this transformation is rather slow, since a DOM/Axiom tree needs to be built.

      As an alternative, we could do this conversion lazily: if we introduce a setSource(Source) method on the WebServiceMessage (or an sub-interface which extends WebServiceMessage), we could simply set the result of the endpoint on the response message, not creating a DOM tree (yet). Later, when the message is written to the transport stream, we directly transform the set payload Source to the stream, thus saving overhead.

      In a way, this is similar to SWS-302, but has the extra benefit that the payload contents is not kept in a buffer.

        Issue Links

          Activity

          Hide
          jim Jim Cummings added a comment -

          Doing a delayed transform from a Source to a Result is interesting and would avoid needing a temporary buffer. But I wonder if doing a transform for these potentially large payloads might introduce extra processing (like possibly parsing the Source) that could be avoided. It might also be tough to do StAX-based (or other on-the-fly transforms/msg generation) endpoints without creating some kind of Source that temporarily stored payload data.

          What if you were able to somehow delay the invocation of the endpoint until the response was actually being written to the transport stream? Maybe a variation of MessageDispatcher could instead of calling the endpoint, it could put a placeholder payload node into the response message holding onto the endpoint (with Axiom maybe a DataSource subclass via the SourcedElement mechanism, not sure if you'd even do streaming with SAAJ), such that when the response message is being serialized to the transport, the endpoint would get called. The response message could maybe be setup so that as the endpoint generates its response, that the Result would write directly to the transport instead of to the message object.

          Offhand it seems like something like this (if it worked) might support endpoints that do large response message generation themselves (via transformations, logic, etc) and for endpoints that primarily get the large response from an external source (db, files, hosts, ...).

          Show
          jim Jim Cummings added a comment - Doing a delayed transform from a Source to a Result is interesting and would avoid needing a temporary buffer. But I wonder if doing a transform for these potentially large payloads might introduce extra processing (like possibly parsing the Source) that could be avoided. It might also be tough to do StAX-based (or other on-the-fly transforms/msg generation) endpoints without creating some kind of Source that temporarily stored payload data. What if you were able to somehow delay the invocation of the endpoint until the response was actually being written to the transport stream? Maybe a variation of MessageDispatcher could instead of calling the endpoint, it could put a placeholder payload node into the response message holding onto the endpoint (with Axiom maybe a DataSource subclass via the SourcedElement mechanism, not sure if you'd even do streaming with SAAJ), such that when the response message is being serialized to the transport, the endpoint would get called. The response message could maybe be setup so that as the endpoint generates its response, that the Result would write directly to the transport instead of to the message object. Offhand it seems like something like this (if it worked) might support endpoints that do large response message generation themselves (via transformations, logic, etc) and for endpoints that primarily get the large response from an external source (db, files, hosts, ...).
          Hide
          olegk Oleg Kalnichevski added a comment -

          Folks

          I am submitting for your consideration a workaround for Spring WS 1.5.5 extending the stock version of the Axiom based SOAP object model with the support for full content streaming. One of my goals was to avoid having to patch Spring WS core source code even if that came at an expense of certain code duplication. I fully realize this is far from being a comprehensive solution to the problem but it still might be a reasonable starting point.

          Here's the basic concept of the extended API

          EntityResult represents a transformation result backed by an arbitrary content entity.

          -------------------------------------
          public interface EntityResult extends Result {

          void setContentEntity(ContentEntity entity);

          }
          -------------------------------------

          ContentEntity is an abstract entity capable of streaming its content out to a OutputStream / Writer

          -------------------------------------
          public interface ContentEntity {

          QName getQName();

          boolean isRepeatable();

          InputStream getContent() throws IOException;

          void writeTo(OutputStream outstream) throws IOException;

          void writeTo(Writer writer) throws IOException;

          }
          -------------------------------------

          XmlObjectEntity is an example of a content entity based on XMLBeans API.

          -------------------------------------
          public class XmlObjectEntity implements ContentEntity {

          private final XmlObject obj;
          private final XmlOptions opts;

          public XmlObjectEntity(final XmlObject xmlobject)

          { super(); Assert.notNull(xmlobject, "'xmlobject' must not be null"); this.obj = xmlobject; this.opts = new XmlOptions(); this.opts.setSaveNoXmlDecl(); }

          public InputStream getContent() throws IOException

          { return this.obj.newInputStream(); }

          public QName getQName()

          { return this.obj.newXMLStreamReader().getName(); }

          public boolean isRepeatable()

          { return true; }

          public void writeTo(final OutputStream outstream) throws IOException

          { this.obj.save(outstream, this.opts); outstream.flush(); }

          public void writeTo(final Writer writer) throws IOException

          { this.obj.save(writer, this.opts); writer.flush(); }

          }
          -------------------------------------

          EntityResult aware endpoints can simply return an instance of ContentEntity as result of the endpoint invocation without having to build an Axiom representation of the payload content in memory or buffering its content in a temporary buffer.

          The only really ugly bit about this workaround is that some class loaders raise IllegalAccessError if an application class extends a package private class from a different JAR. I found no solution to this problem other than adding my classes to the spring-ws-core JAR, which really kind of sucks.

          Is there any hope of this issue being resolved rather sooner than later? I am willing to invest more time into working on a more comprehensive solution, if it is.

          Would it at least be possible to provide a means of replacing stock version of NonCachingPayload with a custom one without having to subclass all those package visible classes in the org.springframework.ws.soap.axiom package?

          Thank you in advance

          Oleg

          Show
          olegk Oleg Kalnichevski added a comment - Folks I am submitting for your consideration a workaround for Spring WS 1.5.5 extending the stock version of the Axiom based SOAP object model with the support for full content streaming. One of my goals was to avoid having to patch Spring WS core source code even if that came at an expense of certain code duplication. I fully realize this is far from being a comprehensive solution to the problem but it still might be a reasonable starting point. Here's the basic concept of the extended API EntityResult represents a transformation result backed by an arbitrary content entity. ------------------------------------- public interface EntityResult extends Result { void setContentEntity(ContentEntity entity); } ------------------------------------- ContentEntity is an abstract entity capable of streaming its content out to a OutputStream / Writer ------------------------------------- public interface ContentEntity { QName getQName(); boolean isRepeatable(); InputStream getContent() throws IOException; void writeTo(OutputStream outstream) throws IOException; void writeTo(Writer writer) throws IOException; } ------------------------------------- XmlObjectEntity is an example of a content entity based on XMLBeans API. ------------------------------------- public class XmlObjectEntity implements ContentEntity { private final XmlObject obj; private final XmlOptions opts; public XmlObjectEntity(final XmlObject xmlobject) { super(); Assert.notNull(xmlobject, "'xmlobject' must not be null"); this.obj = xmlobject; this.opts = new XmlOptions(); this.opts.setSaveNoXmlDecl(); } public InputStream getContent() throws IOException { return this.obj.newInputStream(); } public QName getQName() { return this.obj.newXMLStreamReader().getName(); } public boolean isRepeatable() { return true; } public void writeTo(final OutputStream outstream) throws IOException { this.obj.save(outstream, this.opts); outstream.flush(); } public void writeTo(final Writer writer) throws IOException { this.obj.save(writer, this.opts); writer.flush(); } } ------------------------------------- EntityResult aware endpoints can simply return an instance of ContentEntity as result of the endpoint invocation without having to build an Axiom representation of the payload content in memory or buffering its content in a temporary buffer. The only really ugly bit about this workaround is that some class loaders raise IllegalAccessError if an application class extends a package private class from a different JAR. I found no solution to this problem other than adding my classes to the spring-ws-core JAR, which really kind of sucks. Is there any hope of this issue being resolved rather sooner than later? I am willing to invest more time into working on a more comprehensive solution, if it is. Would it at least be possible to provide a means of replacing stock version of NonCachingPayload with a custom one without having to subclass all those package visible classes in the org.springframework.ws.soap.axiom package? Thank you in advance Oleg
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Thanks, Oleg!

          Show
          arjen.poutsma Arjen Poutsma added a comment - Thanks, Oleg!
          Hide
          olegk Oleg Kalnichevski added a comment -

          My pleasure.

          I do not mean to be pushy, but what the changes of this issue being resolved any time in a foreseeable future?

          Alternatively, would it at least be possible to provide a means of replacing stock version of NonCachingPayload with a custom one?

          Oleg

          Show
          olegk Oleg Kalnichevski added a comment - My pleasure. I do not mean to be pushy, but what the changes of this issue being resolved any time in a foreseeable future? Alternatively, would it at least be possible to provide a means of replacing stock version of NonCachingPayload with a custom one? Oleg
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          This is major change, so I can't apply it in the 1.5 timeline. As soon as the work on Spring 3 has tuned down a little bit, I will start the milestone phase of the next major version (probably 2.0).

          Arjen

          Show
          arjen.poutsma Arjen Poutsma added a comment - This is major change, so I can't apply it in the 1.5 timeline. As soon as the work on Spring 3 has tuned down a little bit, I will start the milestone phase of the next major version (probably 2.0). Arjen
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Resolved. Thanks for the patch, Tareq!

          Show
          arjen.poutsma Arjen Poutsma added a comment - Resolved. Thanks for the patch, Tareq!
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Oops, wrong issue.

          Show
          arjen.poutsma Arjen Poutsma added a comment - Oops, wrong issue.
          Hide
          thrantal Timo Rantalaiho added a comment -

          Hello, Oleg,

          Thankyou for this promising-looking idea!

          It's a bit unclear to us how to use your approach in practice – for example what kind of endpoint to use. We tried applying your code to our spring-ws 1.5.6 based application, and got to the point where Woodstox complained "Can not instantiate a writer for XML result type ContentPayload$EntityResultImpl".

          Do you have any kind of a proof of concept implementation that you could share? Or even hints on how to get started (what kind of endpoint to use and how to provide our own ContentEntity instances where needed).

          We're grateful for all help!

          Show
          thrantal Timo Rantalaiho added a comment - Hello, Oleg, Thankyou for this promising-looking idea! It's a bit unclear to us how to use your approach in practice – for example what kind of endpoint to use. We tried applying your code to our spring-ws 1.5.6 based application, and got to the point where Woodstox complained "Can not instantiate a writer for XML result type ContentPayload$EntityResultImpl". Do you have any kind of a proof of concept implementation that you could share? Or even hints on how to get started (what kind of endpoint to use and how to provide our own ContentEntity instances where needed). We're grateful for all help!
          Hide
          olegk Oleg Kalnichevski added a comment -

          The hacked version of Spring-WS 1.5.x with support for full content streaming happily runs in production of a major European bank.

          I found no way of plugging-in a custom EntityResult implementation other than forking pretty much the entire org.springframework.ws.soap.axiom package [1] and using a custom SoapMessageFactory implementation.

          Unfortunately, I am unable to disclosing any additional details.

          Cheers

          Oleg

          [1] https://src.springframework.org/svn/spring-ws/tags/spring-ws-1.5.6/core/src/main/java/org/springframework/ws/soap/axiom/

          Show
          olegk Oleg Kalnichevski added a comment - The hacked version of Spring-WS 1.5.x with support for full content streaming happily runs in production of a major European bank. I found no way of plugging-in a custom EntityResult implementation other than forking pretty much the entire org.springframework.ws.soap.axiom package [1] and using a custom SoapMessageFactory implementation. Unfortunately, I am unable to disclosing any additional details. Cheers Oleg [1] https://src.springframework.org/svn/spring-ws/tags/spring-ws-1.5.6/core/src/main/java/org/springframework/ws/soap/axiom/
          Hide
          sandermak Sander Mak added a comment -

          I created a combined solution from Oleg's attachment and the solution proposed in [1]. This was developed against Spring-WS 1.5.9.

          It works both for incoming and outgoing MTOM messages. Furthermore, it does not force all outgoing messages from the endpoint to be MTOM optimized like the earlier proposed solution [1] (check isXopPackage() in StreamingAxiomSoapMessage). So it is possible to combine both MTOM and non-MTOM methods on the same endpoint. I've tested this solution only in combination with JAXB marshalling. With the combination of Axiom and JAXB and attachmentCaching enabled it is possible to send and receive large attachments (I tested up to 100mb) while using at most 3mb of heapspace. To use it, build the attached files as part of your project and configure the hacked streaming messagefactory:

          <bean id="messageFactory" class="org.springframework.ws.soap.axiom.StreamingAxiomSoapMessageFactory"> 
              	<property name="payloadCaching" value="false" /> 
              	<property name="attachmentCaching" value="true" /> 
              	<property name="attachmentCacheThreshold" value="1024"/>
              	<!-- Configure tempdir, should be cleaned regularly! -->  
          </bean> 

          I'm sure there is a better way to implement this functionality, so view this code as a temporary and mostly untested workaround. Having to duplicate Spring-WS code is always bad, but in this case I see no other option, like the previous commenters on this issue. Arjen, could you give us some insight as to the status of Axiom/MTOM streaming of outgoing attachments for Spring WS 2.0? Will it be included?

          [1] http://forum.springsource.org/showthread.php?p=161742

          Show
          sandermak Sander Mak added a comment - I created a combined solution from Oleg's attachment and the solution proposed in [1] . This was developed against Spring-WS 1.5.9. It works both for incoming and outgoing MTOM messages. Furthermore, it does not force all outgoing messages from the endpoint to be MTOM optimized like the earlier proposed solution [1] (check isXopPackage() in StreamingAxiomSoapMessage). So it is possible to combine both MTOM and non-MTOM methods on the same endpoint. I've tested this solution only in combination with JAXB marshalling. With the combination of Axiom and JAXB and attachmentCaching enabled it is possible to send and receive large attachments (I tested up to 100mb) while using at most 3mb of heapspace. To use it, build the attached files as part of your project and configure the hacked streaming messagefactory: < bean id = "messageFactory" class = "org.springframework.ws.soap.axiom.StreamingAxiomSoapMessageFactory" > < property name = "payloadCaching" value = "false" /> < property name = "attachmentCaching" value = "true" /> < property name = "attachmentCacheThreshold" value = "1024" /> <!-- Configure tempdir, should be cleaned regularly! --> </ bean > I'm sure there is a better way to implement this functionality, so view this code as a temporary and mostly untested workaround. Having to duplicate Spring-WS code is always bad, but in this case I see no other option, like the previous commenters on this issue. Arjen, could you give us some insight as to the status of Axiom/MTOM streaming of outgoing attachments for Spring WS 2.0? Will it be included? [1] http://forum.springsource.org/showthread.php?p=161742
          Hide
          sandermak Sander Mak added a comment -

          Seeing that this issue is picked up again, I'd like to add that my previous attached implementation does not work as it claims it does. I could not get it to work both on incoming and outgoing requests correctly (i.e. creating/parsing a XOP message, but only when necessary, i.e., if there really is a large attachment). The override of isXopPackage() and friends did not work as I intended. Anyway, thanks for working on this issue.

          Show
          sandermak Sander Mak added a comment - Seeing that this issue is picked up again, I'd like to add that my previous attached implementation does not work as it claims it does. I could not get it to work both on incoming and outgoing requests correctly (i.e. creating/parsing a XOP message, but only when necessary, i.e., if there really is a large attachment). The override of isXopPackage() and friends did not work as I intended. Anyway, thanks for working on this issue.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          It took a while, but I'm happy to announce that this issue has been implemented . I largely based myself on Oleg's code, but made some changes along the way.

          The basic idea is that there is now a org.springframework.ws.stream.StreamingWebServiceMessage, which looks like this:

          public interface StreamingWebServiceMessage extends WebServiceMessage {
           
              void setStreamingPayload(StreamingPayload payload);
          }

          The StreamingPayload looks like this:

          public interface StreamingPayload {
           
              QName getName();
           
              void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException;
          }

          AxiomSoapMessage now implements StreamingWebServiceMessage, and if setStreamingPayload is called, I basically wrap the StreamingPayload in an Axiom OMDataSource, and add that to the body.

          Initial non-scientific testing has shown that this new approach is really fast. When marshalling a JAXB Object with 500 children 1000 times, I get the following:

          -----------------------------------------
          ms     %     Task name
          -----------------------------------------
          01010  030%  caching
          01024  031%  non-caching
          01120  034%  streaming-caching
          00184  006%  streaming-non-caching

          Basically, the first two rows are the approaches we already had. The last two are new, and you can see that the last row (when combining this new setStreamingPayload() functionality with the non-repeatable reads/writes that setPayloadCaching(false gives) is really really fast.

          Show
          arjen.poutsma Arjen Poutsma added a comment - It took a while, but I'm happy to announce that this issue has been implemented . I largely based myself on Oleg's code, but made some changes along the way. The basic idea is that there is now a org.springframework.ws.stream.StreamingWebServiceMessage, which looks like this: public interface StreamingWebServiceMessage extends WebServiceMessage {   void setStreamingPayload(StreamingPayload payload); } The StreamingPayload looks like this: public interface StreamingPayload {   QName getName();   void writeTo(XMLStreamWriter streamWriter) throws XMLStreamException; } AxiomSoapMessage now implements StreamingWebServiceMessage, and if setStreamingPayload is called, I basically wrap the StreamingPayload in an Axiom OMDataSource, and add that to the body. Initial non-scientific testing has shown that this new approach is really fast. When marshalling a JAXB Object with 500 children 1000 times, I get the following: ----------------------------------------- ms % Task name ----------------------------------------- 01010 030% caching 01024 031% non-caching 01120 034% streaming-caching 00184 006% streaming-non-caching Basically, the first two rows are the approaches we already had. The last two are new, and you can see that the last row (when combining this new setStreamingPayload() functionality with the non-repeatable reads/writes that setPayloadCaching(false gives) is really really fast.
          Hide
          nikkeri Nikkeri2001 added a comment -

          Do you have any compelete example how to implement working endpoint using this new feature?
          I wrote a new thread about this on forum. http://forum.springsource.org/showthread.php?t=96124

          Show
          nikkeri Nikkeri2001 added a comment - Do you have any compelete example how to implement working endpoint using this new feature? I wrote a new thread about this on forum. http://forum.springsource.org/showthread.php?t=96124
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          @Nikkeri

          Not yet, but that will be coming in the RC phase. In the mean time, you can look at the unit tests.

          Show
          arjen.poutsma Arjen Poutsma added a comment - @Nikkeri Not yet, but that will be coming in the RC phase. In the mean time, you can look at the unit tests.
          Hide
          nikkeri Nikkeri2001 added a comment -

          Ok,

          I should be wery close now. For some reason I get stack trace on console and and response on client side contains only soap envelope and empty body.

          Client response looks like this:

          <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
          <soapenv:Body/>
          </soapenv:Envelope>

          If you could check the trace and tell your dependencies that may differ, please.

          Problems seems to start when com.sun.xml.internal.bind.v2.runtime.MarshallerImpl starts to write xml from jaxb Response object: com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write -> Can not output XML declaration, after other output has already been done.

          Should I use some particular version of Jaxb (java)?

          My java version is (build 1.6.0_07-b06).
          Spring ws is taken from trunk last week.

          org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]]: null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null
          at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:288)
          at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
          at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97)
          at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
          at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
          at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
          at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
          at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
          at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
          at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
          at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
          at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
          at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
          at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
          at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
          at org.mortbay.jetty.Server.handle(Server.java:326)
          at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
          at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
          at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
          at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
          at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
          at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
          at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
          Caused by: javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null
          at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:331)
          at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67)
          at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
          at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
          at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
          at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
          at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72)
          at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294)
          at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
          at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282)
          ... 24 more
          Caused by: javax.xml.bind.MarshalException

          • with linked exception:
            [javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.]
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
            at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328)
            ... 33 more
            Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
            at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547)
            at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576)
            at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643)
            at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153)
            at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263)
            at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source)
            ... 36 more
            2010-10-06 10:52:21.867::WARN: Nested in org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]]: null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null:
            javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
            at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547)
            at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576)
            at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643)
            at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153)
            at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263)
            at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
            at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328)
            at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67)
            at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
            at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72)
            at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294)
            at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
            at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282)
            at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
            at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97)
            at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
            at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
            at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
            at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
            at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
            at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
            at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
            at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
            at org.mortbay.jetty.Server.handle(Server.java:326)
            at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
            at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
            at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
            2010-10-06 12:14:00.336::WARN: /mpis/mpisValidating/
            org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]]: null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null
            at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:288)
            at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
            at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97)
            at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
            at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
            at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
            at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
            at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
            at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
            at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
            at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
            at org.mortbay.jetty.Server.handle(Server.java:326)
            at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
            at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
            at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
            Caused by: javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null
            at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:331)
            at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67)
            at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
            at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72)
            at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294)
            at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
            at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282)
            ... 24 more
            Caused by: javax.xml.bind.MarshalException
          • with linked exception:
            [javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.]
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
            at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328)
            ... 33 more
            Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
            at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547)
            at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576)
            at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643)
            at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153)
            at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263)
            at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source)
            ... 36 more
            2010-10-06 12:14:00.336::WARN: Nested in org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]]: null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]]: null:
            javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.
            at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547)
            at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576)
            at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655)
            at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643)
            at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153)
            at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263)
            at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source)
            at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source)
            at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328)
            at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67)
            at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691)
            at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283)
            at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245)
            at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72)
            at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294)
            at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193)
            at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282)
            at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45)
            at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97)
            at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57)
            at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230)
            at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
            at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
            at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389)
            at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
            at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181)
            at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
            at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417)
            at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114)
            at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
            at org.mortbay.jetty.Server.handle(Server.java:326)
            at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
            at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879)
            at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747)
            at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
            at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
            at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
            at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
          Show
          nikkeri Nikkeri2001 added a comment - Ok, I should be wery close now. For some reason I get stack trace on console and and response on client side contains only soap envelope and empty body. Client response looks like this: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Body/> </soapenv:Envelope> If you could check the trace and tell your dependencies that may differ, please. Problems seems to start when com.sun.xml.internal.bind.v2.runtime.MarshallerImpl starts to write xml from jaxb Response object: com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write -> Can not output XML declaration, after other output has already been done. Should I use some particular version of Jaxb (java)? My java version is (build 1.6.0_07-b06). Spring ws is taken from trunk last week. org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]] : null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:288) at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) Caused by: javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:331) at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245) at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72) at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193) at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282) ... 24 more Caused by: javax.xml.bind.MarshalException with linked exception: [javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328) ... 33 more Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done. at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547) at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576) at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643) at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263) at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source) ... 36 more 2010-10-06 10:52:21.867::WARN: Nested in org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]] : null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done. at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547) at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576) at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643) at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263) at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328) at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245) at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72) at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193) at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282) at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) 2010-10-06 12:14:00.336::WARN: /mpis/mpisValidating/ org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]] : null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:288) at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520) Caused by: javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:331) at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245) at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72) at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193) at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282) ... 24 more Caused by: javax.xml.bind.MarshalException with linked exception: [javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done.] at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328) ... 33 more Caused by: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done. at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547) at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576) at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643) at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263) at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source) ... 36 more 2010-10-06 12:14:00.336::WARN: Nested in org.springframework.ws.soap.axiom.AxiomSoapMessageException: Could not write message to OutputStream: Could not marshal [[email protected]] : null; nested exception is javax.xml.stream.XMLStreamException: Could not marshal [[email protected]] : null: javax.xml.stream.XMLStreamException: Can not output XML declaration, after other output has already been done. at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1547) at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1576) at com.ctc.wstx.sw.BaseStreamWriter.doWriteStartDocument(BaseStreamWriter.java:667) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:655) at com.ctc.wstx.sw.BaseStreamWriter.writeStartDocument(BaseStreamWriter.java:643) at org.apache.axiom.util.stax.wrapper.XMLStreamWriterWrapper.writeStartDocument(XMLStreamWriterWrapper.java:153) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeStartDocument(MTOMXMLStreamWriter.java:263) at com.sun.xml.internal.bind.v2.runtime.output.XMLStreamWriterOutput.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.XMLSerializer.startDocument(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.prewrite(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.write(Unknown Source) at com.sun.xml.internal.bind.v2.runtime.MarshallerImpl.marshal(Unknown Source) at org.springframework.ws.server.endpoint.adapter.method.jaxb.AbstractJaxb2PayloadMethodProcessor$JaxbStreamingPayload.writeTo(AbstractJaxb2PayloadMethodProcessor.java:328) at org.springframework.ws.soap.axiom.StreamingOMDataSource.serialize(StreamingOMDataSource.java:67) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.internalSerialize(OMSourcedElementImpl.java:691) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:965) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.serializeInternally(SOAPEnvelopeImpl.java:283) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:245) at org.apache.axiom.soap.impl.llom.SOAPMessageImpl.internalSerialize(SOAPMessageImpl.java:72) at org.apache.axiom.om.impl.llom.OMDocumentImpl.internalSerialize(OMDocumentImpl.java:294) at org.apache.axiom.om.impl.llom.OMSerializableImpl.serializeAndConsume(OMSerializableImpl.java:193) at org.springframework.ws.soap.axiom.AxiomSoapMessage.writeTo(AxiomSoapMessage.java:282) at org.springframework.ws.transport.AbstractWebServiceConnection.send(AbstractWebServiceConnection.java:45) at org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:97) at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:57) at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:230) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:560) at javax.servlet.http.HttpServlet.service(HttpServlet.java:727) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:389) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:417) at org.mortbay.jetty.handler.HandlerCollection.handle(HandlerCollection.java:114) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534) at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:879) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:747) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:520)
          Hide
          thrantal Timo Rantalaiho added a comment -

          Hello,

          I thought that by setting

                  <property name="marshallerProperties">
                      <map>
                          <entry key="jaxb.fragment" value="false"/>
                      </map>
                  </property>

          for the Jaxb2Marshaller bean we could get rid of the extra prolog, but no dice. Debugging showed that the relevant code (createMarshaller, initMarshaller) was not even called! createUnMarshaller and initUnMarshaller were visited OK, but the same methods for Marshallers not.

          Then I realised that in JaxbStreamingPayload , the Marshaller is created directly with JaxbContext.createMarshaller() . Could it be that Jaxb2Marshaller should be used here, so that the Marshaller properties could be customised? At the moment, it's not possible to get to customise JaxbStreamingPayload behavior (without heavy copy-pasting), as it is a private class whose instance is created directly in AbstractJaxb2PayloadMethodProcessor where it's used.

          Best wishes,
          Timo

          Show
          thrantal Timo Rantalaiho added a comment - Hello, I thought that by setting < property name = "marshallerProperties" > < map > < entry key = "jaxb.fragment" value = "false" /> </ map > </ property > for the Jaxb2Marshaller bean we could get rid of the extra prolog, but no dice. Debugging showed that the relevant code (createMarshaller, initMarshaller) was not even called! createUnMarshaller and initUnMarshaller were visited OK, but the same methods for Marshallers not. Then I realised that in JaxbStreamingPayload , the Marshaller is created directly with JaxbContext.createMarshaller() . Could it be that Jaxb2Marshaller should be used here, so that the Marshaller properties could be customised? At the moment, it's not possible to get to customise JaxbStreamingPayload behavior (without heavy copy-pasting), as it is a private class whose instance is created directly in AbstractJaxb2PayloadMethodProcessor where it's used. Best wishes, Timo
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          @Timo

          This should now be fixed, as I set the JAXB_FRAGMENT now.

          The reason we are not using the Jaxb2Marshaller abstraction here is that this particular piece of functionality goes beyond what the abstraction can offer. In general, Spring-WS 2.0 has a lot more native JAXB2 support, since comes with the JDK now.

          Show
          arjen.poutsma Arjen Poutsma added a comment - @Timo This should now be fixed, as I set the JAXB_FRAGMENT now. The reason we are not using the Jaxb2Marshaller abstraction here is that this particular piece of functionality goes beyond what the abstraction can offer. In general, Spring-WS 2.0 has a lot more native JAXB2 support, since comes with the JDK now.
          Hide
          arjen.poutsma Arjen Poutsma added a comment -

          Closing old issues

          Show
          arjen.poutsma Arjen Poutsma added a comment - Closing old issues

            People

            • Assignee:
              arjen.poutsma Arjen Poutsma
              Reporter:
              arjen.poutsma Arjen Poutsma
            • Votes:
              16 Vote for this issue
              Watchers:
              20 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 5d
                5d
                Remaining:
                Time Spent - 1d 1h 17m Remaining Estimate - 3d 6h 43m
                3d 6h 43m
                Logged:
                Time Spent - 1d 1h 17m Remaining Estimate - 3d 6h 43m
                1d 1h 17m