/**
* @see javax.xml.soap.SOAPMessage#writeTo(java.io.OutputStream)
*/
public void writeTo(OutputStream out) throws SOAPException, IOException {
try {
OMOutputImpl output = new OMOutputImpl();
output.setCharSetEncoding((String)getProperty(CHARACTER_SET_ENCODING));
String writeXmlDecl = (String)getProperty(WRITE_XML_DECLARATION);
if(writeXmlDecl==null || writeXmlDecl.equals("false")) { //SAAJ default case doesn't send XML decl
output.ignoreXMLDeclaration(true);
}
output.setOutputStream(out, false);
//the writeTo method forces the elements to be built!!!
((SOAPEnvelopeImpl) mSOAPPart.getEnvelope()).getOMEnvelope()
.serializeWithCache(output);
output.flush();
} catch (Exception e) {
throw new SOAPException(e);
}
}