@Override
    public byte[] marshall(SOAPEnvelope data) throws Exception {
        Transformer transformer = TransformerFactory.newInstance().newTransformer();
        StreamResult result = new StreamResult(new StringWriter());
        DOMSource source = new DOMSource(data);
        transformer.transform(source, result);
        String xml = result.getWriter().toString();
        String enc = data.getOwnerDocument().getXmlEncoding();
        if (enc == null) {
            enc = "UTF8"; //$NON-NLS-1$
        }
        return xml.getBytes(enc);
    }
@see io.apiman.gateway.engine.io.IPayloadIO#marshall(java.lang.Object)
gateway/engine/core/src/main/java/io/apiman/gateway/engine/io/SoapPayloadIO.java