throws WSIException
{
try
{
if (this.validator.isOneWayResponse(entryContext))
throw new AssertionNotApplicableException();
// Parse message
Document responseDoc = entryContext.getMessageEntryDocument();
Document requestDoc = entryContext.getRequestDocument();
// messages are empty or invalid, DOM objects are null
if (responseDoc == null || requestDoc == null) {
throw new AssertionNotApplicableException();
}
//if (isFault(responseDoc))
// throw new AssertionNotApplicableException();
// Get SOAPAction
String headers = entryContext.getRequest().getHTTPHeaders();
String action = null;
if (headers != null)
action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());
// Get the binding that is being processed
Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
//Create the types registry
TypesRegistry registry =
new TypesRegistry(
this.validator.getWSDLDocument().getDefinitions(),
validator);
// Find an operation match
OperationSignature.OperationMatch match =
OperationSignature.matchOperation(
requestDoc,
action,
binding,
registry);
if (match == null)
throw new AssertionNotApplicableException();
// Get the binding operation based on the match
BindingOperation bindingOperation = match.getOperation();
// If this is not rpc-literal, then return notApplicable result
if (!WSDLUtils
.isRpcLiteral(match.getOperationStyle(), bindingOperation))
{
throw new AssertionNotApplicableException();
}
// look for <soap:Body> elements:
NodeList soapBodyList =
responseDoc.getElementsByTagNameNS(
WSIConstants.NS_URI_SOAP,
XMLUtils.SOAP_ELEM_BODY);
if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
// Response does not contain any soap Body elements
throw new AssertionNotApplicableException();
// check that no <soap:Body> child or grandchild elements contains a soap:encodingStyle attribute
// For each <soap:Body>
boolean grandChildFound = false;
for (int n = 0; n < soapBodyList.getLength(); n++)
{
Element nextBodyElem = (Element) soapBodyList.item(n);
// REMOVE: This will get all nodes (child, grandchildren, etc.)
//NodeList childList = nextBodyElem.getElementsByTagName("*");
NodeList childList = nextBodyElem.getChildNodes();
if (childList != null)
{
// check all child elements
for (int m = 0; m < childList.getLength(); m++)
{
if (childList.item(m).getNodeType() == Node.ELEMENT_NODE)
{
Element nextChildElem = (Element) childList.item(m);
// check children of this child
// REMOVE: This will get all nodes (child, grandchildren, etc.)
NodeList grandChildList = nextChildElem.getChildNodes();
if (grandChildList != null)
{
for (int p = 0; p < grandChildList.getLength(); p++)
{
if (grandChildList.item(p).getNodeType()
== Node.ELEMENT_NODE)
{
grandChildFound = true;
Element nextGrandChildElem =
(Element) grandChildList.item(p);
if (nextGrandChildElem
.getAttributeNodeNS(
WSIConstants.NS_URI_SOAP,
"encodingStyle")
!= null)
{
// Assertion failed (ADD highlight the child here ?)
throw new AssertionFailException(
entryContext.getMessageEntry().getMessage());
}
}
}
}
}
}
}
}
if (!grandChildFound)
{
throw new AssertionNotApplicableException();
}
}
catch (AssertionFailException e)
{
result = AssertionResult.RESULT_FAILED;