{
SOAPMessage soapMessage = (SOAPMessage)resMessage;
if (soapMessage.getAttachments().hasNext())
throw new IllegalStateException("Attachments not supported with JSON");
SOAPBodyImpl soapBody = (SOAPBodyImpl)soapMessage.getSOAPBody();
BadgerFishDOMDocumentSerializer serializer = new BadgerFishDOMDocumentSerializer(output);
serializer.serialize(soapBody.getBodyElement());
}
else
{
resMessage.writeTo(output);
}