// If the payload is a fault, then we can't set it back on the message
// as a block. Blocks are OMSourcedElements, and faults cannot be OMSourcedElements.
try {
SOAPEnvelope env = (SOAPEnvelope) mepCtx.getMessageObject().getAsOMElement();
String content = env.toStringWithConsume();
MessageFactory mf = (MessageFactory) FactoryRegistry.getFactory(MessageFactory.class);
StringReader sr = new StringReader(content);
XMLStreamReader stream = StAXUtils.createXMLStreamReader(sr);
Message msg = mf.createFrom(stream, mepCtx.getMessageObject().getProtocol());