SOAPEnvelope orgEnvelope = soapFactory.getDefaultEnvelope();
soapFactory.createOMElement("echo", soapFactory.createOMNamespace("urn:test", null)).setText("test");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
OMOutputFormat format = new OMOutputFormat();
format.setCharSetEncoding(encoding);
orgEnvelope.serialize(baos, format);
SOAPMessage message = (SOAPMessage)OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory,
new ByteArrayInputStream(baos.toByteArray()), encoding).getDocument();
assertEquals(encoding, message.getCharsetEncoding());
}
}