Announcement Announcement Module
No announcement yet.
Very large result Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Very large result

    How can I write a service that returns lots of XML data (not binary attachments)?

    Axiom uses Stax, that should write directly to the output stream, but holds it all in memory before flushing.

    Is there a configuration to disable this 'caching'? Is there any workaround for this, besides reimplementing it using a raw Servlet?

  • #2
    Indeed: Axiom holds the response data in memory before flushing. I think the Axis2 people did this by design: if you write directly to the outputstream, there is no way to add SOAP headers to the response after the fact, since headers come before the body. Also, attachments suffer from the same problem.

    I've actually played with the idea of writing our own SOAP library, which streams directly to the outputstream. In theory, you can obtain the HttpServletResponse from the TransportContextHolder, and use the ServletOutputStream to write to. However, I've never written this feature, and I'm afraid the end result would be very fragile, since users have to be very much aware of the layout of a SOAP message, and the order in which elements are written.

    If you have any good ideas as how to solve this, I'm all ears.