users@saaj.java.net

SAAJ-1.3.8: Updating SOAPPart of 'SOAPmessage' vs. SOAPMessage.writeTo(Outputstream)

From: Bernhard Thalmayr <bernhard.thalmayr_at_painstakingminds.com>
Date: Tue, 10 Apr 2012 10:06:34 +0200

Hi experts, I've studied the API but I'm still somewhat clueless ... any
pointers would be appreciated.


If I add some headers to a SOAPMessage like this ...

SOAPEnvelope envelope = soapMessage.getSOAPPart().getEnvelope();
SOAPHeader header = envelope.getHeader();

header.appendChild(someHeader);


I 'see' the header using 'soapMessage.getSOAPPart()'

However it's somehow not persisted within the acutal char-array, which
is used by 'soapMessage.writeTo(Outputstream).

So when I use this method the new header is lost...

However if I use 'soapMessage.saveChanges()' before calling 'writeTo()'
the new header is printed as well.

Interestingly enough 'soapMessage.saveRequired()' returns 'false' after
adding the new header.

None of the methods in the API tells me when I have to use 'saveChanges()'.

TIA,
Bernhard

-- 
Painstaking Minds
IT-Consulting Bernhard Thalmayr
Herxheimer Str. 5, 83620 Vagen (Munich area), Germany
Tel: +49 (0)8062 7769174
Mobile: +49 (0)176 55060699
bernhard.thalmayr_at_painstakingminds.com - Solution Architect
This e-mail may contain confidential and/or privileged information.If 
you are not the intended recipient (or have received this email in 
error) please notify the sender immediately and delete this e-mail. Any 
unauthorized copying, disclosure or distribution of the material in this 
e-mail is strictly forbidden.