while (childElements.hasNext())
{
Object childNode = childElements.next();
if (childNode instanceof SOAPElement)
{
SOAPElementImpl childElement = (SOAPElementImpl)childNode;
// If this message was manipulated by a handler the child may not be a content element
if (!(childElement instanceof SOAPContentElement))
childElement = (SOAPContentElement)soapElement.replaceChild(new SOAPContentElement(childElement), childElement);
// The parameters are expected to be lazy
SOAPContentElement aux = (SOAPContentElement)childElement;
Name elName = aux.getElementName();
if (xmlName.getLocalName().equals("") || xmlName.equals(elName))
{
soapContentElement = aux;
soapContentElement.setParamMetaData(paramMetaData);
break;
}
if (SOAP_ARRAY_NAME.equals(elName))
{
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
msgContext.put(CommonMessageContext.ALLOW_EXPAND_TO_DOM, Boolean.TRUE);
try
{
QName compXMLName = paramMetaData.getXmlName();
Element compElement = DOMUtils.getFirstChildElement(aux);
// NPE when the soap encoded array size is 0 on the return path
// http://jira.jboss.org/jira/browse/JBWS-1285
if (compElement == null || compElement.getNodeName().equals(compXMLName.getLocalPart()))
{
soapContentElement = aux;
soapContentElement.setParamMetaData(paramMetaData);
break;
}
}
finally
{
msgContext.remove(CommonMessageContext.ALLOW_EXPAND_TO_DOM);
}
}
}
}
// If matching by name fails, try to match by xmlType
// This maybe necessary when wsa:Action dispatches to the operation
if (soapContentElement == null)
{
childElements = soapElement.getChildElements();
OperationMetaData opMetaData = paramMetaData.getOperationMetaData();
TypesMetaData typesMetaData = opMetaData.getEndpointMetaData().getServiceMetaData().getTypesMetaData();
if (childElements.hasNext() && opMetaData.getStyle() == Style.DOCUMENT)
{
SOAPElementImpl childElement = (SOAPElementImpl)childElements.next();
// The parameters are expected to be lazy
SOAPContentElement aux = (SOAPContentElement)childElement;
Name elName = aux.getElementName();
QName elType = null;