return;
}
try {
boolean isOutputMsg = (Boolean)mc.get(ObjectMessageContext.MESSAGE_INPUT);
if (!SOAPMessageContext.class.isInstance(mc)) {
throw new SOAPException("SOAPMessageContext not available");
}
SOAPMessageContext soapContext = SOAPMessageContext.class.cast(mc);
SOAPMessage soapMessage = soapContext.getMessage();
if (callback.getMode() == DataBindingCallback.Mode.PARTS) {
// Assuming No Headers are inserted.
Node soapEl = soapMessage.getSOAPBody();
if (callback.getSOAPStyle() == Style.RPC) {
soapEl = NodeUtils.getChildElementNode(soapEl);
}
if (soapEl.hasChildNodes()) {
getParts(soapEl, callback, objContext, isOutputMsg);
} else {
LOG.fine("Body of SOAP message is empty.");
}
getHeaderParts(soapMessage.getSOAPHeader(), callback, objContext, isOutputMsg);
} else if (callback.getMode() == DataBindingCallback.Mode.MESSAGE) {
boolean found = false;
Object obj = null;
for (Class<?> cls : callback.getSupportedFormats()) {
if (cls == SOAPMessage.class) {
obj = soapMessage;
found = true;
break;
} else if (cls == DOMSource.class
|| cls == SAXSource.class
|| cls == StreamSource.class) {
DataReader<SOAPMessage> reader = callback.createReader(SOAPMessage.class);
obj = reader.read(0, soapMessage);
found = true;
break;
}
}
if (!found) {
throw new SOAPException("Cannot unmarshal data");
}
if (isOutputMsg) {
objContext.setReturn(obj);
} else {
objContext.setMessageObjects(obj);
}
} else if (callback.getMode() == DataBindingCallback.Mode.PAYLOAD) {
boolean found = false;
Object obj = null;
for (Class<?> cls : callback.getSupportedFormats()) {
if (cls == DOMSource.class
|| cls == SAXSource.class
|| cls == StreamSource.class
|| cls == Object.class) {
DataReader<SOAPBody> reader = callback.createReader(SOAPBody.class);
obj = reader.read(0, soapMessage.getSOAPBody());
found = true;
break;
}
}
if (!found) {
throw new SOAPException("Cannot unmarshal data");
}
if (isOutputMsg) {
objContext.setReturn(obj);
} else {