MessageFormatter messageFormatter = TransportUtils
.getMessageFormatter(msgContext);
format.setDoOptimize(msgContext.isDoingMTOM());
//Set to null so that the code will not fail on 7bit.
format.setCharSetEncoding(null);
messageFormatter.writeTo(msgContext, format, out, false);
out.flush();
} catch (Exception e) {
throw new AxisFault(e.getMessage(),e);
}
}