if (format.isDoingSWA()) {
// Why are we creating a new OMOutputFormat
OMOutputFormat format2 = new OMOutputFormat();
format2.setCharSetEncoding(format.getCharSetEncoding());
StringWriter bufferedSOAPBody = new StringWriter();
element.serializeAndConsume(bufferedSOAPBody, format2);
writeSwAMessage(msgCtxt, bufferedSOAPBody, bytesOut, format);
} else {
element.serializeAndConsume(bytesOut, format);
}
return bytesOut.toByteArray();