dev@jax-ws.java.net

Re: Message.writeTo(XMLStreamWriter)

From: Jitendra Kotamraju <Jitendra.Kotamraju_at_Sun.COM>
Date: Fri, 14 Jul 2006 13:37:43 -0700

Paul Sandoz wrote:

> Hi,
>
> The JavaDoc for Message.writeTo(XMLStreamWriter) states:
>
> /**
> * Writes the whole SOAP message (but not attachments)
> * to the given writer.
> *
> * This consumes the message.
> * The implementation will not write
> * {_at_link XMLStreamWriter#writeStartDocument()}
> * nor
> * {_at_link XMLStreamWriter#writeEndDocument()}

What's the reason for this ? May be Kohsuke can explain that.

Jitu

> *
> * @throws XMLStreamException
> * If the {_at_link XMLStreamWriter} reports an error,
> * or some other errors happen during the processing.
> */
> public abstract void writeTo(XMLStreamWriter sw) throws
>
> I presume it should be the responsibility of the Codec.encode
> implementation to call XMLStreamWriter.writeStartDocument and
> XMLStreamWriter.writeEndDocument?
>
> The AbstractMessageImpl and SAAJMessageImpl classes do call the
> writeStart/EndDocument, but the StreamMessage does not.
>
> FI requires that a writeStart/EndDocument be called so we need to be
> consistent. I can change the code either way...
>
> Paul.
>