{
Map<QName, UnboundHeader> outHeaders = new HashMap<QName, UnboundHeader>();
Iterator itHeaderElements = soapHeader.getChildElements();
while (itHeaderElements.hasNext())
{
SOAPContentElement soapHeaderElement = (SOAPHeaderElementImpl)itHeaderElements.next();
Name elName = soapHeaderElement.getElementName();
QName xmlName = new QName(elName.getURI(), elName.getLocalName());
UnboundHeader unboundHeader = (UnboundHeader)unboundHeaders.get(xmlName);
if (unboundHeader != null)
{
soapHeaderElement.setParamMetaData(unboundHeader.toParameterMetaData(opMetaData));
// Do the unmarshalling
Object value = soapHeaderElement.getObjectValue();
unboundHeader.setHeaderValue(value);
outHeaders.put(xmlName, unboundHeader);
}
}
unboundHeaders.clear();
unboundHeaders.putAll(outHeaders);
}
Style style = opMetaData.getStyle();
SOAPElement soapElement = soapBody;
if (style == Style.RPC)
{
if (soapBodyElement == null)
throw new WSException("Cannot unbind response message with empty soap body");
soapElement = soapBodyElement;
}
ParameterMetaData retMetaData = opMetaData.getReturnParameter();
if (retMetaData != null)
{
if (retMetaData.isSwA())
{
AttachmentPart part = getAttachmentFromMessage(retMetaData, resMessage);
epInv.setReturnValue(part);
// Add the attachment to the standard property
if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
{
DataHandler dataHandler = part.getDataHandler();
Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
attachments.put(part.getContentId(), dataHandler);
}
}
else
{
SOAPContentElement value = getParameterFromMessage(retMetaData, soapElement, false);
epInv.setReturnValue(value);
}
}
for (ParameterMetaData paramMetaData : opMetaData.getOutputParameters())
{
QName xmlName = paramMetaData.getXmlName();
if (paramMetaData.isSwA())
{
AttachmentPart part = getAttachmentFromMessage(paramMetaData, resMessage);
epInv.setResponseParamValue(xmlName, part);
// Add the attachment to the standard property
if (part.getDataHandler() != null && msgContext instanceof MessageContextJAXWS)
{
DataHandler dataHandler = part.getDataHandler();
Map<String, DataHandler> attachments = (Map<String, DataHandler>)msgContext.get(MessageContext.INBOUND_MESSAGE_ATTACHMENTS);
attachments.put(part.getContentId(), dataHandler);
}
}
else
{
SOAPElement element = paramMetaData.isInHeader() ? soapHeader : soapElement;
SOAPContentElement value = getParameterFromMessage(paramMetaData, element, false);
epInv.setResponseParamValue(xmlName, value);
}
}
}
catch (Exception e)