}
else if (Source.class.isAssignableFrom(type))
{
if (mode == Mode.PAYLOAD)
{
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
SOAPFault soapFault = soapBody.getFault();
if (soapFault != null)
throw new SOAPFaultException(soapFault);
SOAPElement soapElement = soapBody.getBodyElement();
retObj = new DOMSource(soapElement);
}
if (mode == Mode.MESSAGE)
{
SOAPEnvelope soapEnvelope = resMsg.getSOAPPart().getEnvelope();
String xmlMessage = DOMWriter.printNode(soapEnvelope, false);
retObj = new StreamSource(new StringReader(xmlMessage));
}
}
else if (jaxbContext != null)
{
SOAPBodyImpl soapBody = (SOAPBodyImpl)resMsg.getSOAPBody();
SOAPElement soapElement = soapBody.getBodyElement();
log.debug("JAXB unmarshal: " + DOMWriter.printNode(soapElement, false));
Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
retObj = unmarshaller.unmarshal(soapElement);
}