SOAPMessage soapMessage = (SOAPMessage)resMessage;
if (soapMessage.getAttachments().hasNext())
throw new IllegalStateException("Attachments not supported with FastInfoset");
SOAPEnvelope soapEnv = soapMessage.getSOAPPart().getEnvelope();
DOMDocumentSerializer serializer = new DOMDocumentSerializer();
serializer.setOutputStream(output);
serializer.serialize(soapEnv);
}
// JSON support
else if (epMetaData.isFeatureEnabled(JsonEncodingFeature.class) && resMessage instanceof SOAPMessage)
{
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);
}