Document doc =
XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
if (this.validator.isFault(doc))
{
throw new AssertionPassException();
}
// Parse request message
Document docRequest =
XMLUtils.parseXML(entryContext.getRequest().getMessage());
// get SOAPAction
String headers = entryContext.getRequest().getHTTPHeaders();
String action = null;
if (headers != null)
action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
TypesRegistry registry =
new TypesRegistry(
this.validator.getWSDLDocument().getDefinitions(),
validator);
OperationSignature.OperationMatch match =
OperationSignature.matchOperation(
docRequest,
action,
binding,
registry);
if (match == null)
throw new AssertionPassException();
BindingOperation bindingOperation = match.getOperation();
Message operationMessage = null;
if (MessageEntry
.TYPE_REQUEST
.equals(entryContext.getMessageEntry().getType())
&& (bindingOperation.getOperation().getInput() != null))
{
operationMessage =
bindingOperation.getOperation().getInput().getMessage();
}
else
{
if (MessageEntry
.TYPE_RESPONSE
.equals(entryContext.getMessageEntry().getType())
&& (bindingOperation.getOperation().getOutput() != null))
{
operationMessage =
bindingOperation.getOperation().getOutput().getMessage();
}
}
if (operationMessage == null)
throw new AssertionPassException();
boolean isContainArray = false;
Collection parts = operationMessage.getParts().values();
for (Iterator iter = parts.iterator(); iter.hasNext();)
{
Part part = (Part) iter.next();
QName type = null;
if (part.getTypeName() == null)
{
type = registry.getType(part.getElementName());
}
else
{
type = part.getTypeName();
}
isContainArray =
registry.isExtendsArray(type)
|| registry.isUsesWSDLArrayType(type)
|| isArrayType(type);
if (isContainArray)
break;
}
if (isContainArray)
{
// Gets body
NodeList soapBodyList =
doc.getElementsByTagNameNS(
WSIConstants.NS_URI_SOAP,
XMLUtils.SOAP_ELEM_BODY);
if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
{
throw new AssertionFailException();
}
Element soapBodyElem = (Element) soapBodyList.item(0);
NodeList soapBodyCildrenList =
soapBodyElem.getElementsByTagNameNS("*", "*");
for (int indexChild = 0;
indexChild < soapBodyCildrenList.getLength();
indexChild++)
{
Element elem = (Element) soapBodyCildrenList.item(indexChild);
if (elem
.hasAttributeNS(
WSIConstants.NS_URI_SOAP_ENCODING,
WSIConstants.ATTR_ARRAY_TYPE))
{
throw new AssertionFailException();
}
}
throw new AssertionPassException();
}
else
{
throw new AssertionPassException();
}
}
catch (AssertionNotApplicableException e)
{