Results 1 to 3 of 3

Thread: Use of DOMResult withing SaajSoapMessage

  1. #1
    Join Date
    Jul 2006
    Posts
    2

    Default Use of DOMResult withing SaajSoapMessage

    Isn't this a bit inefficient? I often have to return very large results, and the fact that the WebServiceMessage implementation (SaajSoapMessage) stores the results first in a DOM tree before rendering it to the OutputStream means that my service systematically runs out of memory.

    Isn't there a way to directly serialize back to the client? I can do that with XFire.

  2. #2
    Join Date
    Jul 2005
    Location
    Rotterdam, the Netherlands
    Posts
    1,562

    Default

    Quote Originally Posted by drobert_bfm
    Isn't this a bit inefficient? I often have to return very large results, and the fact that the WebServiceMessage implementation (SaajSoapMessage) stores the results first in a DOM tree before rendering it to the OutputStream means that my service systematically runs out of memory.
    Well, there is also the option of using the AxiomSoapMessage instead of the SaajSoapMessage. However, that doesn't really help you with large responses, only with large requests. The reason for this is that the AXIOM model only exposes a XMLStreamReader, and not a XMLStreamWriter.

    Quote Originally Posted by drobert_bfm
    Isn't there a way to directly serialize back to the client? I can do that with XFire.
    There isn't a way (yet). In the future, I will look at the XFire code, and see whether I can create a MessageContext implementation based on that.

    Cheers,
    Arjen Poutsma

    Spring Web Services Dev Lead
    Please read the FAQ

  3. #3
    Join Date
    Jul 2006
    Posts
    2

    Default Direct serialization

    XFire uses StAX throughout, and does require the creation of a XMLStreamReader to return to the engine. I've used two strategies to return the XMLStreamReader:
    1. Use a XMLEventPipe (from the stax-utils project) to connect a XMLEventWriter to an XMLEventReader, and write a XMLStreamReader wrapper for the XMLEventReader, which converts between the two.
    2. Directly write an XMLStreamReader to handle the generation of the output.

    Both are a little unwieldy, but for the kind of document I'm looking at (~100M), it was more than worth it, both in terms of memory usage and of raw performance.

    I saw AxiomSoapMessage, but I haven't figured how to use it yet. I'll take a closer look at it to see if I can do the same thing with it as I did with XFire.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •