Class SoapMessageBase.output() uses an XMLStreamWriter to write a SOAP envelope to a Writer supplied by its callerr. After writing the envelope it omits a flush on the XMLStreamWriter. When the caller flushes and closes its writer some of the envelope data may still be buffered by the XMLStreamWriter and hence may not be pushed through the caller's stream.
n.b. this only manifests when the STAX lib is upgraded from the current implementtaion which uses an nbuffreed XMLStreamWriter to a later version which uses a buffered XMLStreamWriter.