Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope')
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1920.java118
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1928.java426
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1005.java167
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1007.java64
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1008.java277
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1009.java313
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1011.java203
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1012.java102
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1013.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1031.java108
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1032.java152
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1033.java126
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1100.java103
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1107.java277
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1201.java77
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1202.java104
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1203.java147
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1204.java302
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1208.java88
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1211.java147
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1212.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1213.java141
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1214.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1301.java198
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1302.java181
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1305.java132
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1306.java114
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1307.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1308.java97
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1309.java124
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1316.java113
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1318.java183
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1600.java267
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1601.java73
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1701.java110
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1755.java167
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4100.java226
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4101.java132
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4102.java114
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4109.java107
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/EnvelopeValidatorImpl.java56
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP1601.java28
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP9704.java126
43 files changed, 0 insertions, 6424 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1920.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1920.java
deleted file mode 100644
index a7f2ebd07..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1920.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.List;
-
-import javax.wsdl.BindingOperation;
-import javax.wsdl.extensions.mime.MIMEMultipartRelated;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.EntryType;
-
-/**
- * AP1920
- *
- * <context>For an envelope in a response message
- * containing a soap:Fault element</context>
- * <assertionDescription>In a description, if and only if, the wsdl:output
- * element is described using WSDL MIME binding, then the envelope in the
- * response message can contain faults with attachments.</assertionDescription>
- */
-public class AP1920 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param WSDLValidatorImpl
- */
- public AP1920(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /* Validates the test assertion.
- * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (!entryContext.getMessageEntry().isMimeContent())
- {
- throw new AssertionNotApplicableException();
- }
-
- // check for a fault element within the message
- if((entryContext.getMessageEntryDocument() == null) ||
- entryContext.getMessageEntryDocument().
- getElementsByTagNameNS(WSITag.ELEM_SOAP_FAULT.getNamespaceURI(),
- WSITag.ELEM_SOAP_FAULT.getLocalPart()).getLength() != 1)
- throw new AssertionNotApplicableException();
-
- BindingOperation bindingOperation = validator.getOperationMatch(
- EntryType.getEntryType(EntryType.TYPE_MESSAGE_REQUEST),
- entryContext.getRequestDocument());
-
- // If there is no matched operation, the assertion is not applicable
- if (bindingOperation == null)
- throw new AssertionNotApplicableException();
- // If the envelope in a response message contains a fault with attachments
- // and the corresponding wsdl:output element in the description is not
- // described using the WSDL MIME binding, the assertion is failed
- if ((entryContext.getMessageEntry().getMimeParts().count() > 1) &&
- (getMultipartRelatedBindings(bindingOperation) == null))
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- validator.createFailureDetail("The message contains \"" +
- entryContext.getMessageEntry().getMimeParts().count() + "\" part(s)",
- entryContext);
- }
- }
- catch(AssertionNotApplicableException e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Returns Multipart related bindings, if does not found, returns null.
- * @param op binding operation
- * @return Multipart related bindings, if does not found, returns null.
- */
- private MIMEMultipartRelated getMultipartRelatedBindings(
- BindingOperation op)
- {
- // Finding operation extensibility elems
- // in the binding depending on message type
- List extElems = op.getBindingOutput().getExtensibilityElements();
- // check list on first element
- if((extElems == null) || (extElems.size() == 0) ||
- !(extElems.get(0) instanceof MIMEMultipartRelated))
- return null;
- return (MIMEMultipartRelated) extElems.get(0);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1928.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1928.java
deleted file mode 100644
index 5965fcfa4..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/AP1928.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Message;
-import javax.wsdl.Part;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.wsdl.extensions.mime.MIMEMultipartRelated;
-import javax.wsdl.extensions.mime.MIMEPart;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPHeader;
-import javax.xml.namespace.QName;
-
-import org.apache.xerces.xs.XSComplexTypeDefinition;
-import org.apache.xerces.xs.XSConstants;
-import org.apache.xerces.xs.XSElementDeclaration;
-import org.apache.xerces.xs.XSModel;
-import org.apache.xerces.xs.XSModelGroup;
-import org.apache.xerces.xs.XSObjectList;
-import org.apache.xerces.xs.XSParticle;
-import org.apache.xerces.xs.XSTerm;
-import org.apache.xerces.xs.XSTypeDefinition;
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.log.MimePart;
-import org.eclipse.wst.wsi.internal.core.log.MimeParts;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.MIMEConstants;
-import org.eclipse.wst.wsi.internal.core.util.MIMEUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * AP1928
- *
- * <context>For a candidate envelope containing a URI reference
- * that is typed using the ref:swaRef schema type</context>
- * <assertionDescription>In an envelope, a URI reference that is typed using
- * the ref:swaRef schema type resolves to a MIME part in the same message
- * as the envelope.</assertionDescription>
- */
-public class AP1928 extends AssertionProcess implements WSITag
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param WSDLValidatorImpl
- */
- public AP1928(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /* Validates the test assertion.
- * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (!entryContext.getMessageEntry().isMimeContent())
- {
- throw new AssertionNotApplicableException();
- }
- // get the rrot part of a multipart/related message
- Document root = entryContext.getMessageEntryDocument();
- MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
-
- // get an operation matched for the message
- BindingOperation bindingOperation = validator.getOperationMatch(
- entryContext.getEntry().getEntryType(), root);
-
- // if no one operation matches, the assertion is not applicable
- if (bindingOperation == null)
- throw new AssertionNotApplicableException();
-
- // get the corresponding extensibility elements and message
- List extElems;
- Message message;
- if (MessageEntry.TYPE_REQUEST
- .equals(entryContext.getEntry().getEntryType()))
- {
- extElems = bindingOperation.getBindingInput() == null ? null
- : bindingOperation.getBindingInput().getExtensibilityElements();
- message = bindingOperation.getOperation().getInput() == null ? null
- : bindingOperation.getOperation().getInput().getMessage();
- }
- else
- {
- extElems = bindingOperation.getBindingOutput() == null ? null
- : bindingOperation.getBindingOutput().getExtensibilityElements();
- message = bindingOperation.getOperation().getOutput() == null ? null
- : bindingOperation.getOperation().getOutput().getMessage();
- }
-
- // If there are no extensibility elements in the WSDL binding operation,
- // the assertion is not applicable
- if (extElems == null || extElems.size() < 1)
- throw new AssertionNotApplicableException();
-
- // Collecting the names of schema elements that are defined
- // with the ref:swaRef schema type
- List swaRefs = getSwaRefs((ExtensibilityElement)extElems.get(0), message);
- // If such schema elements are not found, the assertion is not applicable
- if (swaRefs.isEmpty())
- throw new AssertionNotApplicableException();
-
- // Going through all the schema element names
- for (int i = 0; i < swaRefs.size(); i++)
- {
- QName elemName = (QName) swaRefs.get(i);
- // Looking for such elements in the root MIME part
- NodeList elems = root.getDocumentElement().getElementsByTagNameNS(
- elemName.getNamespaceURI(), elemName.getLocalPart());
- // Going through all the ref:swaRef references
- for (int j = 0; j < elems.getLength(); j++)
- {
- Node elem = elems.item(j);
- // Getting a value of this reference
- String ref = elem.getFirstChild() == null ? null
- : elem.getFirstChild().getNodeValue();
- // If the value is invalid, the assertion failed
- if (ref == null)
- throw new AssertionFailException("The element " + elem.getNodeName()
- + " of the ref:swaRef schema type is specified, but its vaule"
- + " is invalid.");
- // If the URI does not start with the "cid:" content-id prefix
- // The assertion failed
- if (!ref.startsWith("cid:"))
- {
- throw new AssertionFailException("The URI " + ref
- + " of the ref:swaRef schema type must use the cid: prefix.");
- }
- boolean refFound = false;
- Iterator iMimeParts = mimeParts.getParts().iterator();
- // Going through all the MIME parts of the SOAP message
- while (iMimeParts.hasNext())
- {
- MimePart mimePart = (MimePart)iMimeParts.next();
- // Getting part's Content-ID header
- String cid = MIMEUtils.getMimeHeaderAttribute(
- mimePart.getHeaders(), MIMEConstants.HEADER_CONTENT_ID);
- if (cid != null)
- {
- // If the header value equals the reference URI,
- // the corresponding MIME part is found
- if (cid.equals('<' + ref.substring(4) + '>'))
- {
- refFound = true;
- break;
- }
- }
- }
- // If the corresponding MIME part is not found
- // the assertion failed
- if (!refFound)
- throw new AssertionFailException("The SOAP message does not contain"
- + " a MIME part with the <" + ref.substring(4) + "> Content-ID.");
- }
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Collects names of schema elements that are defined with the ref:swaRef
- * schema type.
- * @param extElem a list of extensibility elements
- * @param message the corresponding message element.
- * @return a list of such names found.
- */
- private List getSwaRefs(ExtensibilityElement extElem, Message message)
- {
- List swaRefs = new ArrayList();
- if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
- {
- // Getting the root mime:part
- List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
- if (mimeParts.size() > 0)
- {
- // Getting extensibility elements of the first mime:part
- List elems = ((MIMEPart) mimeParts.get(0)).getExtensibilityElements();
- List boundParts = new ArrayList();
- // Going through all the MIME part's extensibility elements
- for (int k = 0; k < elems.size(); k ++)
- {
- ExtensibilityElement elem = (ExtensibilityElement) elems.get(k);
- // If that is a soap:body
- if (elem.getElementType().equals(WSDL_SOAP_BODY) && message != null)
- {
- // Getting parts specified by the parts attribute
- List bodyParts = ((SOAPBody) elem).getParts();
- // Collecting all the message parts bound by this soapbind:body
- Iterator i = message.getParts().values().iterator();
- while (i.hasNext())
- {
- Part part = (Part) i.next();
- if (bodyParts == null || bodyParts.contains(part.getName()))
- {
- boundParts.add(part);
- }
- }
- }
- // else if that is a soap:header
- else if (elem.getElementType().equals(WSDL_SOAP_HEADER))
- {
- QName msgName;
- String partName;
- if (elem instanceof SOAPHeader)
- {
- SOAPHeader header = (SOAPHeader) elem;
- // If the part is bound by this element
- msgName = header.getMessage();
- partName = header.getPart();
- }
- // WSDL4J 1.4 does not recognize soap:header elements that
- // are enclosed in mime:multipartRelated, so using a workaround
- else
- {
- Element header =
- ((UnknownExtensibilityElement) elem).getElement();
- // Getting the element's message attribute
- String msgVal = header.getAttribute("message");
- // finding the colon delimiter
- int colonPos = msgVal.indexOf(":");
- String ns = null;
- // Getting a local part
- String lp = colonPos > -1 ? msgVal.substring(colonPos + 1) : msgVal;
- // If the delimiter is found
- if (colonPos > -1)
- {
- // Retrieving a namespace URI
- ns = validator.getWSDLDocument()
- .getDefinitions().getNamespace(msgVal.substring(0, colonPos));
- }
- msgName = new QName(ns, lp);
- partName = header.getAttribute("part");
- }
- // Getting a message referenced by this soapbind:header element
- Message msg =
- validator.getWSDLDocument().getDefinitions().getMessage(msgName);
- if (msg != null)
- {
- // Adding the part to the list of bound parts
- Part part = msg.getPart(partName);
- if (part != null)
- boundParts.add(part);
- }
- }
- }
-
- // All the bound parts from soapbind:body and soapbind:header
- // are collected, finding swaRef references.
- for (int i = 0; i < boundParts.size(); i++)
- {
- Part part = (Part) boundParts.get(i);
- QName ref;
- short type;
- // Getting either part's element reference or type reference
- if ((ref = part.getTypeName()) != null)
- {
- type = XSConstants.TYPE_DEFINITION;
- }
- else if ((ref = part.getElementName()) != null)
- {
- type = XSConstants.ELEMENT_DECLARATION;
- }
- // The part conatins neither element nor type attribute,
- // proceeding with the next part
- else
- {
- continue;
- }
- // Getting a list of schemas defined
- Map schemas = validator.getWSDLDocument().getSchemas();
- // Going through the schemas
- Iterator it = schemas.values().iterator();
- while (it.hasNext())
- {
- XSModel xsModel = (XSModel) it.next();
- XSTypeDefinition xsType = null;
- // Getting the corresponding part type
- if (type == XSConstants.ELEMENT_DECLARATION)
- {
- // Getting schema element
- XSElementDeclaration elem = xsModel.getElementDeclaration(
- ref.getLocalPart(), ref.getNamespaceURI());
- if (elem != null)
- {
- // Getting element's type
- xsType = elem.getTypeDefinition();
- // If it is ref:swaRef
- if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getName())
- && WSIConstants.SCHEMA_TYPE_SWA_REF.equals(
- xsType.getNamespace()))
- {
- // Adding the name of the element to the list
- swaRefs.add(
- new QName(elem.getNamespace(), elem.getName()));
- }
- }
- }
- else
- {
- xsType = xsModel.getTypeDefinition(
- ref.getLocalPart(), ref.getNamespaceURI());
- }
- // Collecting all the element names,adding element names to the list
- swaRefs.addAll(collectSwaRefs(xsType));
- }
- }
- }
- }
- return swaRefs;
- }
-
- /**
- * Collects names of schema elements that are defined with the ref:swaRef
- * schema type.
- * @param xsType a schema type.
- * @return a list of names found.
- */
- private List collectSwaRefs(XSTypeDefinition xsType)
- {
- List swaRefs = new ArrayList();
- if (xsType != null)
- {
- // If this is a complex type
- if (xsType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
- {
- XSComplexTypeDefinition xsComplexType =
- (XSComplexTypeDefinition) xsType;
- // If it contains mixed context
- if (xsComplexType.getParticle() != null)
- {
- // collecting element names
- swaRefs.addAll(collectSwaRefs(xsComplexType.getParticle().getTerm()));
- }
- }
- }
- return swaRefs;
- }
-
- /**
- * Collects names of schema elements that are defined with the ref:swaRef
- * schema type.
- * @param term a schema term.
- * @return a list of names found.
- */
- private List collectSwaRefs(XSTerm term)
- {
- List swaRefs = new ArrayList();
- // If a term is an element declaration
- if (term.getType() == XSConstants.ELEMENT_DECLARATION)
- {
- XSElementDeclaration elem = (XSElementDeclaration) term;
- XSTypeDefinition xsType = elem.getTypeDefinition();
- // If element's type is ref:swaRef
- if (WSIConstants.NS_URI_SWA_REF.equals(xsType.getNamespace())
- && WSIConstants.SCHEMA_TYPE_SWA_REF.equals(xsType.getName()))
- {
- // Add element's name to the list
- swaRefs.add(
- new QName(elem.getNamespace(), elem.getName()));
- }
- else
- {
- // else collecting element names from element's type
- swaRefs.addAll(collectSwaRefs(xsType));
- }
- }
- // else if a term is a model group
- else if(term.getType() == XSConstants.MODEL_GROUP)
- {
- // Getting a list of Particle schema components
- XSObjectList list = ((XSModelGroup) term).getParticles();
- for (int i = 0; i < list.getLength(); i++)
- {
- // Collecting element names
- swaRefs.addAll(collectSwaRefs(((XSParticle) list.item(i)).getTerm()));
- }
- }
- return swaRefs;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1005.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1005.java
deleted file mode 100644
index 7aa465d13..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1005.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.HTTPUtils;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1005.
- */
-public class BP1005 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1005(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (this.validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Parse message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If this is a fault mesage, then it is not applicable
- if (this.validator.isFault(doc))
- {
- throw new AssertionNotApplicableException();
- }
-
- // Check if there is a soap body element
- if (!this.validator.containsSoapBodyWithChild(doc))
- {
- throw new AssertionNotApplicableException();
- }
-
- // Parse request message
- Document docRequest = entryContext.getRequestDocument();
-
- // 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 AssertionNotApplicableException();
-
- BindingOperation bindingOperation = match.getOperation();
-
- // Is rpc style?
- if (!WSIConstants
- .ATTRVAL_SOAP_BIND_STYLE_RPC
- .equals(match.getOperationStyle()))
- throw new AssertionNotApplicableException();
-
- List extElements = null;
-
- if (bindingOperation.getBindingOutput() != null)
- extElements =
- bindingOperation.getBindingOutput().getExtensibilityElements();
-
- // Is message RPC-literal?
- if (!validator.isLiteral(extElements))
- throw new AssertionNotApplicableException();
-
- //Get message
-
- // Gets body
- NodeList soapBodyList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_BODY);
- if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
- {
- // There is not a body or more than one bodies in the envlope.
- throw new AssertionFailException();
- }
- Element soapBodyElem = (Element) soapBodyList.item(0);
-
- // Find wrapper element in the body
- Element wrapperElement = XMLUtils.getFirstChild(soapBodyElem);
- if (wrapperElement == null)
- {
- throw new AssertionFailException();
- }
-
- if (wrapperElement
- .getLocalName()
- .equals(bindingOperation.getName() + "Response"))
- {
- result = AssertionResult.RESULT_PASSED;
- }
- else
- {
- result = AssertionResult.RESULT_FAILED;
- }
-
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- }
- catch (AssertionNotApplicableException e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1007.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1007.java
deleted file mode 100644
index 469486968..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1007.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-
-
-/**
- * BP1007
- *
- * <context>For a candidate message, in the message log file</context>
- * <assertionDescription>DTDs relating to soap:header or soap:body documents, are not present in the message: no DOCTYPE element is present.</assertionDescription>
- */
-public class BP1007 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1007(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- // Parse log message
- Document doc = entryContext.getMessageEntryDocument();
- if (doc == null)
- {
- // message is empty or invalid, the assertion is not applicable
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- // else if the message contains a Document Type Declaration, the assertion failed
- else if (doc.getDoctype() != null)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- testAssertion.getFailureDetailDescription(), entryContext);
- }
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1008.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1008.java
deleted file mode 100644
index 21202362e..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1008.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Message;
-import javax.wsdl.Part;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1008.
- * Message has part accessor elements for parameters and return value, in no namespaces,
- * but the children of these are namespace qualified with the same targetNamespace with which
- * their types are defined.
- */
-public class BP1008 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1008(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /* (non-Javadoc)
- * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
-
- if (this.validator.isOneWayResponse(entryContext))
- throw new AssertionFailException(
- AssertionResult.RESULT_NOT_APPLICABLE);
-
- // Parse message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If there is no message, then throw fail exception
- if (doc == null)
- throw new AssertionFailException();
-
- if (this.validator.isFault(doc))
- {
- throw new AssertionFailException(
- AssertionResult.RESULT_NOT_APPLICABLE);
- }
-
- // Check if there is a soap body element
- if (!this.validator.containsSoapBodyWithChild(doc))
- {
- throw new AssertionNotApplicableException();
- }
-
- // Parse request message
- Document docRequest = entryContext.getRequestDocument();
-
- // get SOAPAction
- String action =
- validator.getSoapAction(entryContext.getRequest().getHTTPHeaders());
-
- Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
- //Definition definition = entryContext.getAnalyzerContext().getCandidateInfo().getDefinitions()[0];
- TypesRegistry registry =
- new TypesRegistry(
- this.validator.getWSDLDocument().getDefinitions(),
- validator);
- OperationSignature.OperationMatch match =
- OperationSignature.matchOperation(
- docRequest,
- action,
- binding,
- registry);
- if (match == null)
- throw new AssertionNotApplicableException();
-
- BindingOperation bindingOperation = match.getOperation();
-
- // Is rpc style?
- if (!WSIConstants
- .ATTRVAL_SOAP_BIND_STYLE_RPC
- .equals(match.getOperationStyle()))
- throw new AssertionFailException(
- AssertionResult.RESULT_NOT_APPLICABLE);
-
- // Gets body
- NodeList soapBodyList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_BODY);
- if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
- {
- // There is not a body or more than one bodies in the envlope.
- throw new AssertionFailException();
- }
- Element soapBodyElem = (Element) soapBodyList.item(0);
-
- result = null;
-
- // Find operation in the body
- Element soapOperation = XMLUtils.getFirstChild(soapBodyElem);
- if (soapOperation == null)
- {
- throw new AssertionFailException();
- }
-
- // Find operation message and ext. elements in the binding
- Message operationMessage = null;
- List extElements = null;
- if (MessageEntry
- .TYPE_REQUEST
- .equals(entryContext.getMessageEntry().getType()))
- {
- operationMessage =
- bindingOperation.getOperation().getInput().getMessage();
- if (bindingOperation.getBindingInput() != null)
- extElements =
- bindingOperation.getBindingInput().getExtensibilityElements();
- }
- else
- {
- if (MessageEntry
- .TYPE_RESPONSE
- .equals(entryContext.getMessageEntry().getType()))
- {
- operationMessage =
- bindingOperation.getOperation().getOutput().getMessage();
- if (bindingOperation.getBindingOutput() != null)
- extElements =
- bindingOperation.getBindingOutput().getExtensibilityElements();
- }
- }
-
- // Is message RPC-literal?
- if (!validator.isLiteral(extElements))
- throw new AssertionFailException(
- AssertionResult.RESULT_NOT_APPLICABLE);
-
- // gets first child of message
- Element soapMessagePart = XMLUtils.getFirstChild(soapOperation);
- if (soapMessagePart == null)
- {
- throw new AssertionPassException();
- }
-
- while (soapMessagePart != null)
- {
- // check whether part accessor or return are in no namespace
-
- if (soapMessagePart.getNamespaceURI() != null
- || "".equals(soapMessagePart.getNamespaceURI()))
- {
- throw new AssertionFailException();
- }
-
- // check whether children are namespace qualified
- // with the same targetNamespace with which their types are defined
- String typesTargetNS =
- getTypeNS(operationMessage, soapMessagePart.getLocalName());
-
- if (typesTargetNS == null)
- throw new AssertionFailException();
-
- if (!checkChildrenNamespace(soapMessagePart, typesTargetNS))
- {
- throw new AssertionFailException();
- }
-
- soapMessagePart = XMLUtils.getNextSibling(soapMessagePart);
- }
-
- result = AssertionResult.RESULT_PASSED;
-
- }
- catch (AssertionFailException e)
- {
- if (e.getMessage() != null && e.getMessage().length() > 0)
- result = e.getMessage();
- else
- result = AssertionResult.RESULT_FAILED;
- }
- catch (AssertionPassException e)
- {
- result = AssertionResult.RESULT_PASSED;
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- if (result == AssertionResult.RESULT_FAILED)
- {
- failureDetail = this.validator.createFailureDetail(null, entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-
- /**
- * Gets part type NS.
- * @param message
- * @param partName
- * @return String
- */
- private String getTypeNS(Message message, String partName)
- {
- Part part = message.getPart(partName);
- if (part == null)
- return null;
- else
- return part.getTypeName().getNamespaceURI();
- }
-
- /**
- * Checks children elements' namespace.
- * @param node
- * @param typesTargetNS
- * @return boolean
- */
-
- private boolean checkChildrenNamespace(Element node, String typesTargetNS)
- {
- NodeList parts = node.getElementsByTagName("*");
- for (int i = 0; i < parts.getLength(); i++)
- {
- Element part = (Element) parts.item(i);
- if (!typesTargetNS.equals(part.getNamespaceURI()))
- {
- return false;
- }
- if (!checkChildrenNamespace(part, typesTargetNS))
- {
- return false;
- }
- }
- return true;
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1009.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1009.java
deleted file mode 100644
index 32e401b07..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1009.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Vector;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Definition;
-import javax.wsdl.Message;
-import javax.wsdl.OperationType;
-import javax.wsdl.Part;
-import javax.wsdl.extensions.soap.SOAPHeader;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.HTTPUtils;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1009.
- * Message includes all soapbind:headers specified in the wsdl:input
- * (if request) or wsdl:output (if response) of the operation referred
- * to by its wsdl:binding, and may also include headers that were not specified.
- */
-public class BP1009 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1009(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /**
- * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (this.validator.isOneWayResponse(entryContext))
- {
- throw new AssertionNotApplicableException();
- }
-
- // Parse message
- Document doc = entryContext.getMessageEntryDocument();
-
- // Parse request message
- Document docRequest = entryContext.getRequestDocument();
-
- if (doc == null || docRequest == null)
- throw new AssertionNotApplicableException();
-
- // Check if there is a soap body element
- if (!this.validator.containsSoapBodyWithChild(doc))
- {
- throw new AssertionNotApplicableException();
- }
-
- if (this.validator.isFault(doc))
- {
- throw new AssertionFailException(
- AssertionResult.RESULT_NOT_APPLICABLE);
- }
-
- // 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 AssertionNotApplicableException();
- }
-
- BindingOperation bindingOperation = match.getOperation();
-
- // If this is a one-way operation and we are processing a response, then set result to notApplicable
- if (bindingOperation
- .getOperation()
- .getStyle()
- .equals(OperationType.ONE_WAY)
- && (entryContext
- .getMessageEntry()
- .getType()
- .equals(MessageEntry.TYPE_RESPONSE)))
- {
- throw new AssertionNotApplicableException();
- }
-
- // find body
- NodeList soapBodyList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_BODY);
- if (soapBodyList.getLength() == 0 || soapBodyList.getLength() > 1)
- {
- // There is not a body or more than one bodies in the envlope.
- throw new AssertionPassException();
- }
- // find headers
- NodeList soapHeaders =
- doc.getElementsByTagNameNS(
- WSITag.ELEM_SOAP_HEADER.getNamespaceURI(),
- WSITag.ELEM_SOAP_HEADER.getLocalPart());
-
- //find all operation
- //Element soapOperation = XMLUtils.getFirstChild(soapBodyElem);
-
- // gets soapbind:headers
- List bindingHeaders = null;
- if (entryContext
- .getMessageEntry()
- .getType()
- .equals(MessageEntry.TYPE_REQUEST))
- {
- if (bindingOperation.getBindingInput() != null)
- bindingHeaders =
- bindingOperation.getBindingInput().getExtensibilityElements();
- else
- throw new AssertionFailException();
-
- }
- else
- {
- if (entryContext
- .getMessageEntry()
- .getType()
- .equals(MessageEntry.TYPE_RESPONSE))
- {
- if (bindingOperation.getBindingOutput() != null)
- bindingHeaders =
- bindingOperation.getBindingOutput().getExtensibilityElements();
- else
- throw new AssertionFailException();
- }
- }
- if (bindingHeaders == null || bindingHeaders.size() == 0)
- {
- throw new AssertionPassException();
- }
-
- Iterator iterator = bindingHeaders.iterator();
- while (iterator.hasNext())
- {
- Object bindingHeader = iterator.next();
- if (bindingHeader instanceof SOAPHeader)
- {
- // find soapbind:header in SOAP message
- if (!isBindingHeaderInSOAPMessage(entryContext,
- soapHeaders,
- (SOAPHeader) bindingHeader))
- {
- throw new AssertionFailException();
- }
- }
- }
-
- result = AssertionResult.RESULT_PASSED;
-
- }
- catch (AssertionFailException e)
- {
- if (e.getMessage() != null && e.getMessage().length() > 0)
- result = e.getMessage();
- else
- result = AssertionResult.RESULT_FAILED;
- }
- catch (AssertionPassException e)
- {
- result = AssertionResult.RESULT_PASSED;
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- if (result == AssertionResult.RESULT_FAILED)
- {
- failureDetail = this.validator.createFailureDetail(null, entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-
- /**
- * Checks whether specified SOAPHeader is in the SOAPMessage.
- * @param soapHeaderList
- * @param SOAPHeader
- * @return boolean
- */
- private boolean isBindingHeaderInSOAPMessage(
- EntryContext entryContext,
- NodeList soapHeaders,
- SOAPHeader bindingHeader)
- {
-
- Message msg = getMessageByQName(entryContext, bindingHeader.getMessage());
- if (msg == null)
- return false;
-
- Part part = msg.getPart(bindingHeader.getPart());
- if (part == null)
- return false;
-
- QName partElementName = part.getElementName();
- QName partTypeName = part.getTypeName();
-
- if (partTypeName == null && partElementName == null)
- return false;
-
- if (soapHeaders == null || soapHeaders.getLength() == 0)
- {
- return false;
- }
- Vector headersList =
- XMLUtils.getChildElements((Element) soapHeaders.item(0));
-
- for (int indexHeader = 0;
- indexHeader < headersList.size();
- indexHeader++)
- {
- Element soapHeaderPart = (Element) headersList.get(indexHeader);
- if (soapHeaderPart != null)
- {
- QName soapHeaderPartQName =
- new QName(
- soapHeaderPart.getNamespaceURI(),
- soapHeaderPart.getLocalName());
- if ((partTypeName != null
- && partTypeName.equals(soapHeaderPartQName))
- || (partElementName != null
- && partElementName.equals(soapHeaderPartQName)))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Gets message by QName.
- * @param entryContext
- * @param messageName
- * @return Message
- */
- private Message getMessageByQName(
- EntryContext entryContext,
- QName messageName)
- {
- Definition[] defs = validator.analyzerContext.getCandidateInfo().getDefinitions();
- for (int i = 0; i < defs.length; i++)
- {
- Message msg = defs[i].getMessage(messageName);
- if (msg != null)
- return msg;
- }
- return null;
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1011.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1011.java
deleted file mode 100644
index 3a37ab6c9..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1011.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-/**
- * BP1011.
- */
-public class BP1011 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1011(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // TODO need to handle soap with attachments
- if (entryContext.getMessageEntry().isMimeContent())
- throw new AssertionNotApplicableException();
-
- Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings();
-
- // get soap message child name
- // Get the DOM contents of the message soap:body (if non-empty)
- Document messageDoc = null;
-
- QName messagePartElementQName = null;
-
- if (!entryContext.getMessageEntry().getMessage().equals(""))
- {
- messageDoc = entryContext.getMessageEntryDocument();
- //messageDoc = XMLUtils.parseXML(entryContext.getMessageEntry().getMessage(),
- // WSIProperties.DEF_SOAP_SCHEMA);
- // get soap operation name from the soap:body
-
- // NOTE: getSoapBodyChild() may return null, if the soap:body did not contain any child elements
- Element soapMessageElement = validator.getSoapBodyChild(messageDoc);
-
- // for doc-lit... find the wsdl:part from one of the specified operations that has
- // the soap element used in the message.
- // we are looking for a part with an element attrib val matching the soap message element
- if (soapMessageElement != null)
- {
- messagePartElementQName =
- new QName(
- soapMessageElement.getNamespaceURI(),
- soapMessageElement.getLocalName());
- }
- }
-
- if ((messageDoc == null) || this.validator.isFault(messageDoc))
- {
- // empty messages and fault messages do not qualify for this TA
- throw new AssertionNotApplicableException();
- }
-
- // look for match(s) in doc operations
- // if found, we're done, else
- // look for match(s) in rpc operations
-
- /* Doc-lit
- * get list of operations (from candidates) for which the first soap:body child QName is the
- * <part element="..."> value of that operation's <wsdl:input> or <wsdl:output> element (depending
- * on whether message is a request or a response).
- */
-
- BindingOperation[] docBindingOperations =
- validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
- bindings);
- // list of operations that match the <wsdl:input> or <wsdl:output> (depending on entryType)
- // for part element="..."
- // (ISSUE: what about part type="..."?)
- BindingOperation[] potentialDocLitOps =
- validator.getDocLitOperations(
- entryContext.getEntry().getEntryType(),
- messagePartElementQName,
- docBindingOperations);
- if (potentialDocLitOps.length != 0)
- {
- // found at least one doc lit match
-
- // *** Now we know it's document-literal, schema-validate the SOAP payload accordingly
- try
- {
- this.validator.messageIsDocLitSchemaValid(entryContext);
- }
- catch (Exception e)
- {
- throw new AssertionFailException(e.getMessage());
- }
- throw new AssertionPassException();
- }
-
- /* soap message is not doc-lit so try :
- * Rpc-lit
- */
- BindingOperation[] rpcBindingOperations =
- this.validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
- bindings);
-
- // Determine if there is an operation match
- BindingOperation rcpOpMatch =
- this.validator.getOperationMatch(
- entryContext.getEntry().getEntryType(),
- messageDoc,
- rpcBindingOperations);
- if (rcpOpMatch != null)
- {
- // Determine if the parts match
- rcpOpMatch =
- this.validator.getOperationPartsMatch(
- entryContext.getEntry().getEntryType(),
- messageDoc,
- rpcBindingOperations);
- }
-
- if (rcpOpMatch == null)
- {
- //not matched with rpc either. Prepare assertion failure.
- StringBuffer rpcOperationList = new StringBuffer();
- for (int i = 0; i < rpcBindingOperations.length; i++)
- {
- rpcOperationList.append(rpcBindingOperations[i].toString() + "\n");
- }
-
- StringBuffer docOperationList = new StringBuffer();
- for (int i = 0; i < docBindingOperations.length; i++)
- {
- docOperationList.append(docBindingOperations[i].toString() + "\n");
- }
-
- throw new AssertionFailException(
- "--MESSAGE:\n"
- + entryContext.getMessageEntry().getMessage()
- + "\n--CANDIDATE RPC STYLE OPERATIONS ("
- + (rpcBindingOperations.length != 0
- ? (rpcBindingOperations.length + "):\n" + rpcOperationList)
- : "NONE)")
- + "\n--CANDIDATE DOCUMENT STYLE OPERATIONS ("
- + (docBindingOperations.length != 0
- ? (docBindingOperations.length + "):\n" + docOperationList)
- : "NONE)"));
-
- }
- }
- catch (AssertionPassException e)
- {
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- catch (AssertionNotApplicableException e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // Return assertion result
-
- return validator.createAssertionResult(testAssertion, result, failureDetail);
-
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1012.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1012.java
deleted file mode 100644
index 115d4efe4..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1012.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1012.
- */
-public class BP1012 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1012(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // look for <soap:Envelope> elements:
- // (Note: since this is a Soap message we expect exactly one soap envelope, but we do not assume it).
- Document requestDoc = entryContext.getRequestDocument();
-
- // message is empty or invalid, the assertion is not applicable
- if (requestDoc == null)
- throw new AssertionNotApplicableException();
-
- Element envElem = requestDoc.getDocumentElement();
- //NodeList soapEnvList = requestDoc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Envelope");
-
- // If the document element tag name is not Envelope
- // or the namespace is http://schemas.xmlsoap.org/soap/envelope/
- if (!envElem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)
- || envElem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP))
- // Request contains proper soap Envelope element
- throw new AssertionNotApplicableException();
-
- // we expect a Soap Fault as a response
- Document responseDoc =
- XMLUtils.parseXML(entryContext.getResponse().getMessage());
- NodeList soapFaultList =
- responseDoc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- "Fault");
- // ADD extra check here that the <soap:Fault> is a child of <soap:Envelope> ??
- if ((soapFaultList == null) || (soapFaultList.getLength() == 0))
- {
- // No Soap fault found.
- // Assertion failed (ADD highlight the child here ?)
- throw new AssertionFailException(
- "--- REQUEST:\n"
- + entryContext.getRequest().getMessage()
- + "\n--- RESPONSE:\n"
- + entryContext.getResponse().getMessage());
- }
-
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1013.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1013.java
deleted file mode 100644
index eb6f8eb54..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1013.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-
-
-
-/**
- * BP1013.
- */
-public class BP1013 extends BP1011
-{
- /**
- * @param BaseMessageValidator
- */
- public BP1013(BaseMessageValidator impl)
- {
- super(impl);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1031.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1031.java
deleted file mode 100644
index cfbdafbc0..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1031.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-
-
-/**
- * BP1031.
- *
- * @author: Graham Turrell, IBM UK
- */
-public class BP1031 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1031(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- failureDetail = null;
- try
- {
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- if (!this.validator.isFault(doc))
- {
- throw new AssertionNotApplicableException();
- }
-
- NodeList faultCodes = doc.getElementsByTagName("faultcode");
- for (int i = 0; i < faultCodes.getLength(); i++)
- {
- NodeList faultCodeNodes = (faultCodes.item(i)).getChildNodes();
- for (int j = 0; j < faultCodeNodes.getLength(); j++)
- {
- if (faultCodeNodes.item(j) instanceof Text)
- {
- Text faultCodeText = (Text) faultCodeNodes.item(j);
- if (faultCodeText.getData().indexOf('.') > 0)
- {
- throw new AssertionFailException();
- // dotted notation used.
- }
- }
- }
- }
-
- throw new AssertionPassException();
- // no dotted notation used in a faultcode element
- }
- catch (AssertionPassException e)
- {
- result = AssertionResult.RESULT_PASSED;
- }
- catch (AssertionNotApplicableException e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_WARNING;
- failureDetail =
- this.validator.createFailureDetail(
- entryContext.getMessageEntry().getMessage(),
- entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1032.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1032.java
deleted file mode 100644
index 47413072a..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1032.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-
-/**
- * BP1032
- *
- * <context>For a candidate envelope</context>
- * <assertionDescription>The soap:Envelope, soap:Header, and soap:Body elements do not have any attributes in the namespace "http://schemas.xmlsoap.org/soap/envelope/"</assertionDescription>
- */
-public class BP1032 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1032(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- try
- {
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- throw new AssertionNotApplicableException();
-
- // Getting a root element
- Element element = doc.getDocumentElement();
-
- // Assuming that root element should be soap:Envelope
- // If not, the assertion is not applicable
- if (!element.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
- throw new AssertionNotApplicableException();
-
- // looking for any attribute of soap:Envelope in the namespace
- // "http://schemas.xmlsoap.org/soap/envelope/"
- // If at least one attribute is found, the assertion failed
- Attr attr = getAttribute(element.getAttributes());
- if (attr != null)
- throw new AssertionFailException("soap:Envelope attribute name is "
- + attr.getName());
-
- // Getting the first child of soap:Envelope
- element = XMLUtils.getFirstChild(element);
-
- // If the child is soap:Header
- if (element != null
- && element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER))
- {
- // looking for any attribute of soap:Header in the namespace
- // "http://schemas.xmlsoap.org/soap/envelope/"
- // If at least one attribute is found, the assertion failed
- attr = getAttribute(element.getAttributes());
- if (attr != null)
- throw new AssertionFailException("soap:Header attribute name is "
- + attr.getName());
-
- // Moving to the next soap:Envelope child
- element = XMLUtils.getNextSibling(element);
- }
-
- // If the child is soap:Body
- if (element != null
- && element.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY))
- {
- // looking for any attribute of soap:Body in the namespace
- // "http://schemas.xmlsoap.org/soap/envelope/"
- // If at least one attribute is found, the assertion failed
- attr = getAttribute(element.getAttributes());
- if (attr != null)
- throw new AssertionFailException("soap:Body attribute name is "
- + attr.getName());
- }
-
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Looks for an attribute that is in the namespace
- * http://schemas.xmlsoap.org/soap/envelope/
- * @param attrs a collection of attributes
- * @return an attribute in the specified namespace or null
- */
- private Attr getAttribute(NamedNodeMap attrs)
- {
- Attr ret = null;
- if (attrs != null)
- {
- for(int i = 0; i < attrs.getLength(); i++)
- {
- Attr attr = (Attr) attrs.item(i);
- if (attr.getNamespaceURI() != null
- && attr.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP))
- {
- ret = attr;
- break;
- }
- }
- }
-
- return ret;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1033.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1033.java
deleted file mode 100644
index 12ec8a11b..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1033.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * BP1033
- *
- * <context>For a candidate envelope</context>
- * <assertionDescription>The SOAP envelope does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
- */
-public class BP1033 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1033(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the root element
- Element elem = doc.getDocumentElement();
- // If it is not the soap:Envelope, the assertion is not applicable
- if (!elem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP)
- || !elem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
- {
- throw new AssertionNotApplicableException();
- }
-
- // If the envelope contains the xmlns:xml namespace declaration,
- // the assertion failed
- String incorrectElementName = getIncorrectElementName(elem);
- if (incorrectElementName != null)
- {
- throw new AssertionFailException("The name of an element containing "
- + "such namespace declaration is \"" + incorrectElementName + "\".");
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_WARNING;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Looks for any element that contains the attribute xmlns:xml="http://www.w3.org/XML/1998/namespace".
- * @param elem the root element.
- * @return the name of an element found or null.
- */
- private String getIncorrectElementName(Element elem)
- {
- // Getting a value of the attribute xmlns:xml
- String attrValue = elem.getAttributeNS(
- WSIConstants.NS_URI_XMLNS, "xml");
- // If it equals to "http://www.w3.org/XML/1998/namespace",
- // return an element name;
- if (WSIConstants.NS_URI_XML.equals(attrValue))
- {
- return elem.getNodeName();
- }
- // Going through element's children
- Element child = XMLUtils.getFirstChild(elem);
- while (child != null)
- {
- // If any of them has xmlns:xml attribute, return a value
- String name = getIncorrectElementName(child);
- if (name != null)
- {
- return name;
- }
- // Getting the next element's child
- child = XMLUtils.getNextSibling(child);
- }
- // No xmlns:xml attributes found, return null
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1100.java
deleted file mode 100644
index 12bad72bf..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1100.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.Utils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1100.
- * A message that does not contain a SOAP fault SHOULD use a "200 OK"
- * HTTP status code.
- */
-public class BP1100 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1100(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /**
- * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- if (this.validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:Fault> element:
- Document doc = entryContext.getMessageEntryDocument();
- if (doc == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- Element root = doc.getDocumentElement();
- NodeList faultList =
- root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Fault");
-
- // If response does not contain a soap:Fault, then check it
- if ((faultList == null) || (faultList.getLength() == 0))
- {
- // Response does not contain a soap:Fault
- // check HTTP status code
- String httpStatus =
- Utils.getHTTPStatusCode(
- entryContext.getMessageEntry().getHTTPHeaders());
- if (!"200".equals(httpStatus))
- {
- result = AssertionResult.RESULT_WARNING;
- //failureDetailMessage = entryContext.getMessageEntry().getMessage();
- failureDetail =
- this.validator.createFailureDetail(
- "\nResponse message:\nHeaders:\n"
- + entryContext.getMessageEntry().getHTTPHeaders()
- + "\nMessage:\n"
- + entryContext.getMessageEntry().getMessage(),
- entryContext);
- }
- }
-
- // If it is a soap:Fault, then the result must be notApplicable
- else
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1107.java
deleted file mode 100644
index 11c86917d..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1107.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.io.StringWriter;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Vector;
-
-import javax.wsdl.Fault;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Part;
-import javax.wsdl.extensions.soap.SOAPFault;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcessVisitor;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.NullUtil;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.util.WSDLUtil;
-import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
-import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-/**
- * BP1107.
- * The contained soapbind:fault is defined in the wsdl:binding.
- */
-public class BP1107 extends AssertionProcessVisitor
-{
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1107(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- private OperationSignature responseSig = null;
- private Vector faults = null;
-
- /**
- * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(SOAPFault, Object, WSDLTraversalContext)
- */
- public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
- {
- String faultName = fault.getName();
-
- if (faultName == null)
- faultName = ctx.getBindingFault().getName();
-
- Operation op = ctx.getBindingOperation().getOperation();
- if (op == null /* || faultName == null*/
- ) // may be it's possible to have legal fault with null name
- return;
-
- // we suppose that SOAPFault.getName() corresponds to the abstract operation's fault name
- Fault f = op.getFault(faultName);
- if (f == null)
- return;
-
- Message m = f.getMessage();
- // message should have only one part
- if (m == null || m.getParts() == null || m.getParts().size() != 1)
- return;
-
- //Part faultPart = WSDLUtil.getPart(m, faultName);
- Part faultPart = (Part) m.getParts().values().iterator().next();
-
- TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry");
- QName elemQName = faultPart.getElementName();
- QName typeQName = faultPart.getTypeName();
- if (typeQName == null)
- typeQName = tReg.getType(faultPart.getElementName());
- if (typeQName == null)
- throw new IllegalArgumentException("Part type can not be null.");
-
- // for all faults; if it presents in the definition remove it from list
- for (int i = 0; i < faults.size();)
- {
- Element elem = (Element) faults.get(i);
-
- // TODO: I don't understand why this is here. Only the element setting should be checked.
- //boolean matchByType =
- // elem.getLocalName().equals(typeQName.getLocalPart()) && NullUtil.equals(elem.getNamespaceURI(), typeQName.getNamespaceURI());
-
- boolean matchByElement =
- elemQName != null
- && elem.getLocalName().equals(elemQName.getLocalPart())
- && NullUtil.equals(
- elem.getNamespaceURI(),
- elemQName.getNamespaceURI());
-
- //if (matchByType || matchByElement)
- if (matchByElement)
- faults.remove(i);
- else
- i++;
- }
- }
-
- /**
- * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- if (this.validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // Parse request and response message
- Document docRequest = entryContext.getRequestDocument();
- Document docResponse = entryContext.getMessageEntryDocument();
-
- if ((docRequest == null) || (docResponse == null))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else if (!this.validator.isFault(docResponse))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // create request signature
- OperationSignature.OperationMatch match =
- OperationSignature.matchOperation(
- docRequest,
- this.validator.getSoapAction(entryContext.getRequest().getHTTPHeaders()),
- validator.analyzerContext.getCandidateInfo().getBindings()[0],
- new TypesRegistry(
- validator.analyzerContext
- .getCandidateInfo()
- .getWsdlDocument()
- .getDefinitions(),
- validator));
-
- result = AssertionResult.RESULT_NOT_APPLICABLE;
-
- if (match != null)
- {
- // MOVED: Parse response message
- //doc = entryContext.getMessageEntryDocument();
-
- responseSig = new OperationSignature(docResponse);
- if (WSIConstants
- .ATTRVAL_SOAP_BIND_STYLE_RPC
- .equals(match.getOperationStyle()))
- responseSig.createRPCSignature();
-
- WSDLTraversal traversal = new WSDLTraversal();
- //VisitorAdaptor.adapt(this);
- traversal.setVisitor(this);
- traversal.visitSOAPFault(true);
- traversal.ignoreBindingInput();
- traversal.ignoreBindingOutput();
-
- if (responseSig == null || !responseSig.isFault())
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else if (responseSig != null && responseSig.isFault())
- {
- // extract all faults and try find them in the definition
- // extracts only faults with namespace
- Element body =
- XMLUtils.findChildElement(
- docResponse.getDocumentElement(),
- WSITag.ELEM_SOAP_BODY);
- Element fault =
- XMLUtils.findChildElement(body, WSITag.ELEM_SOAP_FAULT);
- Element detail = XMLUtils.getElement("detail", fault);
- if (detail == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- result = AssertionResult.RESULT_PASSED;
-
- faults = XMLUtils.getChildElements(detail);
-
- // REMOVE: Why do the faults have to be namespaced qualified?
- //XMLUtils.removeAllElementsWithoutNS(faults);
-
- // if faults exist try to validate it
- if (faults.size() > 0)
- {
- Map m = new HashMap();
- WSDLUtil.expandDefinition(
- validator.analyzerContext
- .getCandidateInfo()
- .getWsdlDocument()
- .getDefinitions());
- m.put(
- "definition",
- validator.analyzerContext
- .getCandidateInfo()
- .getWsdlDocument()
- .getDefinitions());
- TypesRegistry tReg =
- new TypesRegistry(
- validator.analyzerContext
- .getCandidateInfo()
- .getWsdlDocument()
- .getDefinitions(),
- validator);
- m.put("TypesRegistry", tReg);
- traversal.traverse(match.getOperation(), m);
- if (faults.size() > 0)
- {
- result = AssertionResult.RESULT_WARNING;
- StringWriter sw = new StringWriter();
- for (int i = 0; i < faults.size(); i++)
- {
- try
- {
- XMLUtils.serializeElement((Element) faults.get(i), sw);
- }
- catch (Exception e)
- {
- }
- }
- try
- {
- sw.close();
- }
- catch (Exception e)
- {
- }
- failureDetail =
- this.validator.createFailureDetail(
- "\nFaults:\n" + sw.toString(),
- entryContext);
- }
- else
- result = AssertionResult.RESULT_PASSED;
- }
- }
- }
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1201.java
deleted file mode 100644
index 7af6934b4..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1201.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-/**
- * BP1201.
- * The namespace of the soap:Envelope in the message has value: http://schemas.xmlsoap.org/soap/envelope/.
- */
-public class BP1201 extends AssertionProcess implements WSITag
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1201(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- Document doc;
- // Check if this is one way response or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext) ||
- (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- Element root = doc.getDocumentElement();
- String ns = root.getNamespaceURI();
- String local = root.getLocalName();
- if (!ELEM_SOAP_ENVELOPE.getNamespaceURI().equals(ns))
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- "Root element has namespace: " + ns, entryContext);
- }
-
- else if (!ELEM_SOAP_ENVELOPE.getLocalPart().equals(local))
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- "Root element has local name: " + local, entryContext);
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1202.java
deleted file mode 100644
index a5abee105..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1202.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1202.
- * Each child element (if any) of the soap:Body element is namespace qualified (not the grandchildren).
- */
-public class BP1202 extends AssertionProcess implements WSITag
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1202(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- // Parse log message
- Document doc = entryContext.getMessageEntryDocument();
-
- if (validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // Check if there is a soap body element
- else if (!validator.containsSoapBodyWithChild(doc))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // Get the root element
- Element root = doc.getDocumentElement();
-
- // Get a node list which should contain the soap:Body element
- NodeList rootNodeList = root.getElementsByTagNameNS(
- ELEM_SOAP_BODY.getNamespaceURI(), ELEM_SOAP_BODY.getLocalPart());
-
- // If there is at least one soap:Body element,
- // then make sure that each child is namespace qualified
- if (rootNodeList.getLength() > 0)
- {
- // Get the soap:Body element
- Element body = (Element) rootNodeList.item(0);
-
- // Get the list of soap:Body child elements
- NodeList children = body.getChildNodes();
-
- // Make sure that each child element is namespace qualified
- for (int i = 0;
- i < children.getLength() && result == AssertionResult.RESULT_PASSED;
- ++i)
- {
- Node n = children.item(i);
- if (n instanceof Element)
- {
- String ns = n.getNamespaceURI();
- if (ns == null || ns.length() == 0)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- entryContext.getMessageEntry().getMessage(), entryContext);
- }
- }
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1203.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1203.java
deleted file mode 100644
index 8470acb61..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1203.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1203.
- * The namespace of the detail element of a qualified attribute in the soap:Fault is a
- * foreign namespace, different from "http://schemas.xmlsoap.org/soap/envelope/".
- */
-public class BP1203 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1203(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- boolean qualifiedAttributes = false;
-
- Document doc;
- // Check if this is one way response or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // ADD: Need to determine if this check is required, since it should already be done
- // Applicable to response messages only
- if (entryContext
- .getMessageEntry()
- .getType()
- .equalsIgnoreCase(MessageEntry.TYPE_RESPONSE))
- {
- // look for <soap:Fault> element:
- NodeList faultList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_FAULT);
- if ((faultList == null) || (faultList.getLength() == 0))
- {
- // Response does not contain a soap:Fault
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // we have a soap:Fault.
- else
- {
- try
- {
- // look at each soap:Fault in turn
- for (int i = 0; i < faultList.getLength(); i++)
- {
- Element soapFault = (Element) faultList.item(i);
- // find the detail element(s) if any
- NodeList detailList =
- soapFault.getElementsByTagName(XMLUtils.SOAP_ELEM_FAULT_DETAIL);
- if (detailList != null)
- {
- // for each detail element...
- for (int j = 0; j < detailList.getLength(); j++)
- {
- NamedNodeMap detailAttribs =
- detailList.item(j).getAttributes();
- // check for any qualified attributes
- if (detailAttribs != null)
- {
- for (int k = 0; k < detailAttribs.getLength(); k++)
- {
- Attr nextAttr = (Attr) (detailAttribs.item(k));
- // for each qualified attribute, check that
- // qname != http://schemas.xmlsoap.org/soap/envelope
- if (nextAttr.getNamespaceURI() != null)
- {
- qualifiedAttributes = true;
- if (nextAttr
- .getNamespaceURI()
- .equals(WSIConstants.NS_URI_SOAP))
- {
- // found unexpected qname
- throw new AssertionFailException(
- entryContext.getMessageEntry().getMessage());
- }
- }
- }
- }
- }
- }
- }
-
- if (!qualifiedAttributes)
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
- else
- {
- // target message is not a Response
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1204.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1204.java
deleted file mode 100644
index 5bf480deb..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1204.java
+++ /dev/null
@@ -1,302 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.Message;
-import javax.wsdl.Part;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.HTTPUtils;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1204.
- * The serialized array form in the message does not contain the
- * soapenc:arrayType attribute.
- *
- */
-public class BP1204 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1204(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /**
- * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
-
- if (this.validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Parse message
- 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)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- this.validator.createFailureDetail(
- entryContext.getMessageEntry().getMessage(),
- entryContext);
- }
- catch (AssertionPassException e)
- {
- result = AssertionResult.RESULT_PASSED;
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-
- /**
- * Checks whether type uses an array or not.
- * @param type
- * @return boolean
- */
- private boolean isArrayType(QName type)
- {
- boolean arrayType = false;
-
- Element typeElement = getTypeElement(type);
- if (typeElement != null)
- {
- NodeList list =
- typeElement.getElementsByTagNameNS(
- WSIConstants.NS_URI_XSD,
- "sequence");
- if (list.getLength() > 0)
- arrayType = true;
- }
-
- return arrayType;
- }
-
- /**
- * Gets XML element defining the type.
- * @param type
- * @return Element
- */
- private Element getTypeElement(QName type)
- {
- Types[] allTypes = validator.analyzerContext.getCandidateInfo().getTypes();
- for (int i = 0; allTypes != null && i < allTypes.length; i++)
- {
- Element typesElement = null;
- if (allTypes[i] != null)
- {
- typesElement = allTypes[i].getDocumentationElement();
- if (typesElement == null)
- {
- List extList = allTypes[i].getExtensibilityElements();
- for (Iterator iter = extList.iterator(); iter.hasNext();)
- {
- ExtensibilityElement extElem = (ExtensibilityElement) iter.next();
-
- if (extElem
- .getElementType()
- .equals(new QName(WSIConstants.NS_URI_XSD, "schema")))
- {
- typesElement =
- ((UnknownExtensibilityElement) extElem).getElement();
- break;
- }
- }
- }
- if (typesElement != null)
- {
- NodeList complexTypesList =
- typesElement.getElementsByTagNameNS(
- WSIConstants.NS_URI_XSD,
- "complexType");
- for (int j = 0; j < complexTypesList.getLength(); j++)
- {
- Element typeElem = (Element) complexTypesList.item(j);
- if (type.getLocalPart().equals(typeElem.getAttribute("name")))
- {
- return typeElem;
- }
- }
-
- }
- }
- }
- return null;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1208.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1208.java
deleted file mode 100644
index a26af9236..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1208.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLTraversal;
-import org.w3c.dom.Document;
-import org.w3c.dom.ProcessingInstruction;
-
-
-/**
- * BP1208 NOT FULLY TESTED.
- */
-public class BP1208 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1208(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- // Parse log message
- Document doc = entryContext.getMessageEntryDocument();
- if (doc == null) {
- //message is empty or invalid, the assertion is not applicable
- result = AssertionResult.RESULT_NOT_APPLICABLE;
-
- } else {
-
- // Traverse document looking for processing instructions.
- // ISSUE: this inner class needs ... revisiting/replacing
- // EG. Do we want to list all processing instructions,
- // or is the first sufficient?
- XMLTraversal traversal = new XMLTraversal()
- {
- public void visit(ProcessingInstruction pi)
- {
- try
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetailMessage =
- "Target: " + pi.getTarget() + ", Data: " + pi.getData();
- }
- catch (Exception e)
- {
- // ADD: How should this exception be handled?
- }
-
- super.visit(pi);
- }
- };
-
- traversal.visit(doc);
-
- if (result == AssertionResult.RESULT_FAILED
- && failureDetailMessage != null)
- {
- failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext);
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1211.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1211.java
deleted file mode 100644
index 69133b820..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1211.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.HTTPUtils;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.wsdl.WSDLUtils;
-import org.eclipse.wst.wsi.internal.core.xml.XMLTags;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-
-/**
- * BP1211.
- *
- * Context:
- * For a candidate message in the message log file, that is referred by a binding style RPC-literal
- *
- * Description:
- * Part accessor elements in the message do not have an xsi:nil attribute with a value of "1" or "true".
- */
-public class BP1211 extends AssertionProcess implements XMLTags
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1211(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- /**
- * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
- */
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Parse message
- Document doc = entryContext.getMessageEntryDocument();
- Document docRequest = entryContext.getRequestDocument();
-
- Element soapOperation = null;
- // If there is a Fault entry or no body entries,
- // the assertion is not applicable
- if (validator.isFault(doc)
- || (soapOperation = validator.getSoapBodyChild(doc)) == null)
- 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(
- docRequest,
- 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();
-
- // Going through all the accessors
- Element accessor = XMLUtils.getFirstChild(soapOperation);
- while (accessor != null)
- {
- Attr attr = XMLUtils.getAttribute(accessor, ATTR_XSI_NIL);
- // If there is xsi:nil attribute and its value is "1" or "true"
- // the assertion failed
- if (attr != null
- && (attr.getValue().equals("1") || attr.getValue().equals("true")))
- {
- throw new AssertionFailException("The accessor name is "
- + accessor.getNodeName());
- }
- // Getting the next accessor
- accessor = XMLUtils.getNextSibling(accessor);
- }
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1212.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1212.java
deleted file mode 100644
index 8c1f77280..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1212.java
+++ /dev/null
@@ -1,165 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.BindingOperation;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * BP1212
- *
- * <context>For a candidate non-fault envelope containing a soap:body with at least one element</context>
- * <assertionDescription>The envelope contains exactly one part accessor element for each of the wsdl:part elements bound to the envelope's corresponding soapbind:body element.</assertionDescription>
- */
-public class BP1212 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1212(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- Element soapOperation = null;
- // If there is a Fault entry or no body entries,
- // the assertion is not applicable
- if (validator.isFault(doc)
- || (soapOperation = validator.getSoapBodyChild(doc)) == null)
- throw new AssertionNotApplicableException();
-
- // Creating a qualified name of potential SOAP operation
- QName operationQName = new QName(
- soapOperation.getNamespaceURI(), soapOperation.getLocalName());
-
- // Retrieving all the RPC binding operations from wsdl:binding
- BindingOperation[] rpcBindingOperations =
- validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
- validator.analyzerContext.getCandidateInfo().getBindings());
-
- // Retrieving binding operation by given operation name
- BindingOperation bindingOperation = validator.getOperationMatch(
- entryContext.getEntry().getEntryType(),
- operationQName,
- rpcBindingOperations);
-
- // If there is no matched operation, the assertion is not applicable
- if (bindingOperation == null)
- throw new AssertionNotApplicableException();
-
- // Finding operation message parts and extensibility elems
- // in the binding depending on message type
- List operationMessageParts = null;
- List extElems = null;
- if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_REQUEST))
- {
- operationMessageParts = bindingOperation.getOperation()
- .getInput().getMessage().getOrderedParts(null);
- if (bindingOperation.getBindingInput() != null)
- extElems =
- bindingOperation.getBindingInput().getExtensibilityElements();
- }
- else
- {
- operationMessageParts = bindingOperation.getOperation()
- .getOutput().getMessage().getOrderedParts(null);
- if (bindingOperation.getBindingOutput() != null)
- extElems =
- bindingOperation.getBindingOutput().getExtensibilityElements();
- }
-
- // Getting all the accessors of the operation element
- List accessors = XMLUtils.getChildElements(soapOperation);
- // Getting the ordered list of wsdl:part names
- List orderedPartNames =
- validator.orderPartNames(operationMessageParts, extElems);
- // Going through all the wsdl:part names
- Iterator i = orderedPartNames.iterator();
- while (i.hasNext())
- {
- String partName = (String) i.next();
- // If there is not exactly one accessor for the part specified,
- // the assertion failed
- if (getPartsCount(accessors, partName) != 1)
- throw new AssertionFailException(
- "The name of wsdl:part is " + partName);
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Counts the amount of accessors of a specific name
- * @param accessors a list of accessors
- * @param name the name of accessor elements to be counted
- * @return
- */
- private int getPartsCount(List accessors, String name)
- {
- int count = 0;
-
- for (int i = 0; i < accessors.size(); i++)
- {
- Element accessor = (Element) accessors.get(i);
- if (accessor.getLocalName().equals(name))
- count++;
- }
-
- return count;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1213.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1213.java
deleted file mode 100644
index 555d8463c..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1213.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.List;
-
-import javax.wsdl.BindingOperation;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * BP1213
- *
- * <context>For a candidate non-fault envelope containing a soap:Body element, and is referred by a doc-literal binding</context>
- * <assertionDescription>The envelope has no element content in the soap:Body element if the value of the parts attribute of the soapbind:body is an empty string in the corresponding doc-literal description.</assertionDescription>
- */
-public class BP1213 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1213(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- Element messageElement = null;
- // If the message is empty or invalid or there is a Fault entry
- // or there is no body entries, the assertion is not applicable
- if (doc == null
- || validator.isFault(doc)
- || (messageElement = validator.getSoapBodyChild(doc)) == null)
- throw new AssertionNotApplicableException();
-
- // Getting a qualified name of message element
- QName messagePartElementQName = new QName(
- messageElement.getNamespaceURI(), messageElement.getLocalName());
-
- // Retrieving all the document binding operations from wsdl:binding
- BindingOperation[] docBindingOperations =
- validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
- validator.analyzerContext.getCandidateInfo().getBindings());
-
- // Retrieving binding operation by given element name
- BindingOperation[] potentialDocLitOps =
- validator.getDocLitOperations(
- entryContext.getEntry().getEntryType(),
- messagePartElementQName,
- docBindingOperations);
-
- // If there is not exactly one operation matched,
- // the assertion is not applicable
- if (potentialDocLitOps.length != 1)
- throw new AssertionNotApplicableException();
-
- // Finding operation extensibility elems
- // in the binding depending on message type
- List extElems = null;
- if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_REQUEST)
- && potentialDocLitOps[0].getBindingInput() != null)
- {
- extElems = potentialDocLitOps[0]
- .getBindingInput().getExtensibilityElements();
- }
- else if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_RESPONSE)
- && potentialDocLitOps[0].getBindingOutput() != null)
- {
- extElems = potentialDocLitOps[0]
- .getBindingOutput().getExtensibilityElements();
- }
-
- // Getting the parts attribute from soapbind:body
- List parts = null;
- SOAPBody soapBody = validator.getSOAPBody(extElems);
- if (soapBody != null)
- parts = soapBody.getParts();
-
- // if the parts attribute is an empty string and there is
- // at least one accessor, the assertion failed
- if (parts != null && parts.isEmpty()
- && !XMLUtils.getChildElements(messageElement).isEmpty())
- throw new AssertionFailException("wsdl:operation name is "
- + potentialDocLitOps[0].getName());
-
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1214.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1214.java
deleted file mode 100644
index ada1346ee..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1214.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.List;
-
-import javax.wsdl.BindingOperation;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * BP1214
- *
- * <context>For a candidate non-fault envelope containing a soap:Body element, and is referred by a rpc-literal binding</context>
- * <assertionDescription>The envelope does not contain any part accessor elements if the value of the parts attribute of the soapbind:body is an empty string in the corresponding rpc-literal description.</assertionDescription>
- */
-public class BP1214 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1214(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- Element soapOperation = null;
- // If there is a Fault entry or no body entries,
- // the assertion is not applicable
- if (validator.isFault(doc)
- || (soapOperation = validator.getSoapBodyChild(doc)) == null)
- throw new AssertionNotApplicableException();
-
- // Creating a qualified name of potential SOAP operation
- QName operationQName = new QName(
- soapOperation.getNamespaceURI(), soapOperation.getLocalName());
-
- // Retrieving all the RPC binding operations from wsdl:binding
- BindingOperation[] rpcBindingOperations =
- validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
- validator.analyzerContext.getCandidateInfo().getBindings());
-
- // Retrieving binding operation by given operation name
- BindingOperation bindingOperation = validator.getOperationMatch(
- entryContext.getEntry().getEntryType(),
- operationQName,
- rpcBindingOperations);
-
- // If there is no matched operation, the assertion is not applicable
- if (bindingOperation == null)
- throw new AssertionNotApplicableException();
-
- // Finding operation extensibility elems
- // in the binding depending on message type
- List extElems = null;
- if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_REQUEST)
- && bindingOperation.getBindingInput() != null)
- {
- extElems =
- bindingOperation.getBindingInput().getExtensibilityElements();
- }
- else if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_RESPONSE)
- && bindingOperation.getBindingOutput() != null)
- {
- extElems =
- bindingOperation.getBindingOutput().getExtensibilityElements();
- }
-
- // If the message is not literal, the assertion is not applicable
- if (!validator.isLiteral(extElems))
- throw new AssertionNotApplicableException();
-
- // Getting the parts attribute from soapbind:body
- List parts = null;
- SOAPBody soapBody = validator.getSOAPBody(extElems);
- if (soapBody != null)
- parts = soapBody.getParts();
-
- // if the parts attribute is an empty string and there is
- // at least one accessor, the assertion failed
- if (parts != null && parts.isEmpty()
- && !XMLUtils.getChildElements(soapOperation).isEmpty())
- throw new AssertionFailException("wsdl:operation name is "
- + bindingOperation.getName());
-
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1301.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1301.java
deleted file mode 100644
index 92a20c735..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1301.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Vector;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1301.
- */
-public class BP1301 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1301(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- //Get the requets message and check the value of mustUnderstand.
- String message = entryContext.getMessageEntry().getMessage();
- Object[] mustUnderstandAttributes = getMustUnderstandAttributes(message);
-
- if (mustUnderstandAttributes == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- for (int index = 0; index < mustUnderstandAttributes.length; index++)
- {
- if ((mustUnderstandAttributes[index] != null)
- && (mustUnderstandAttributes[index].equals("1")
- || mustUnderstandAttributes[index].equals("0")))
- {
- result = AssertionResult.RESULT_PASSED;
- }
- else
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- this.validator.createFailureDetail(
- "The SOAP mustUnderstand attribute was present "
- + " and its value was "
- + mustUnderstandAttributes[index],
- entryContext);
- } //End if
- } //End for
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-
- //Retreives the value of the mustUnderstand attribute from ALL SOAP header
- //If the Header is missing or if it does not contain any targets or if
- //the header does not contain a mustUnderstand attribute then set the
- //assertionResult to RESULT_NOT_APPLICABLE.
- private Object[] getMustUnderstandAttributes(String message)
- throws WSIException
- {
- if (message == null || message.trim().equals("")) {
- return null;
- }
-
- Document doc = XMLUtils.parseXML(message);
- NodeList headers =
- doc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header");
-
- //If a header not present set result to notApplicable
- //else process each headerEntry
- if (headers.getLength() <= 0)
- {
- return null;
- }
- else
- {
- Vector mustUnderstandAttributes = new Vector();
- Element header = (Element) headers.item(0);
- if (header == null)
- return null;
-
- NodeList headerEntries = header.getChildNodes();
- //For each header entry check retreive the mustUnderstand attribute
- //if any, else set the test result to notApplicable
-
- //This is used to indicate if a header contained any child Elements
- boolean headerTargets = false;
-
- for (int index = 0; index < headerEntries.getLength(); ++index)
- {
- Node headerEntry = headerEntries.item(index);
- if (headerEntry.getNodeType() == Node.ELEMENT_NODE)
- {
- headerTargets = true;
- Attr mustUnderstand =
- ((Element) headerEntry).getAttributeNodeNS(
- WSIConstants.NS_URI_SOAP,
- "mustUnderstand");
- //Retreive the value of the mustUnderstand attribute of the request.
- if (mustUnderstand != null)
- {
- String mustUnderstandValue = mustUnderstand.getNodeValue();
- mustUnderstandAttributes.add(mustUnderstandValue);
- }
- else
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- //The SOAP Header does not contain a mustUnderstand attribute."
- } // mustUnderstand != null
- }
- } //End for
-
- if (!headerTargets)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- //The SOAP Header does not contain any header entries.
- }
-
- return mustUnderstandAttributes.toArray();
- } //End If headers.getLength() < 0
- }
-
- /**
- * Returns true if this object is must understand fault code.
- * @param faultCodeElem understand fault code.
- * @return true if this object is must understand fault code.
- */
- public boolean isMustUnderstandFaultCode(Element faultCodeElem)
- {
- //A faultcode may or maynot have a prefix, if it does its namespace should be
- //htt://schemas.xmlsoap.org/soap/envelope which is the same as the faultcode element.
- //If a prefix is present and it corresponds to a different namespace or is null
- //then this returns false. The local part of the faultcode is then check to see
- //if it is one of the permitted values.
- if (faultCodeElem == null)
- return false;
-
- String faultCode = faultCodeElem.getFirstChild().getNodeValue().trim();
- if (faultCode == null)
- return false;
-
- String faultCodeElemPrefix = faultCodeElem.getPrefix();
- String faultCodePrefix = faultCode.substring(0, faultCode.indexOf(':'));
- String faultCodeName =
- faultCode.substring(faultCode.indexOf(':') + 1, faultCode.length());
-
- if ((faultCodeElemPrefix != null || faultCodePrefix != null))
- {
- if (faultCodePrefix.equals(faultCodeElemPrefix)
- && (faultCodeName.equals("MustUnderstand")
- || faultCodeName.startsWith("MustUnderstand.")))
- return true;
- else
- return false;
- }
- else
- {
- if (faultCode.equals("MustUnderstand")
- || faultCodeName.startsWith("MustUnderstand."))
- return true;
- else
- return false;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1302.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1302.java
deleted file mode 100644
index 63acd565a..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1302.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1302.
- * The soap:faultcode value in the soap:Fault element of the response
- * message is not custom, and is one of: VersionMismatch, MustUnderstand, Client, Server.
- */
-public class BP1302 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1302(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- //SOAP fault code values should not be custom: only standard code qualifiers
- //are used: VersionMismatch, MustUnderstand, Client, Server
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- //String requestMessage = null;
- String responseMessage = null;
-
- if (this.validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- //Get the response message check the faultcode.
- MessageEntry logEntryResponse = entryContext.getResponse();
- if (logEntryResponse != null)
- {
- responseMessage = logEntryResponse.getMessage();
-
- Document targetDoc = XMLUtils.parseXML(responseMessage);
- NodeList faultCodes = targetDoc.getElementsByTagName("faultcode");
- // targetDoc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "faultcode");
-
- if (faultCodes.getLength() <= 0)
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- //No faultcode
-
- for (int i = 0; i < faultCodes.getLength(); i++)
- {
- Node faultCodeElem = faultCodes.item(i);
- //If the faultcode was MustUnderstand, check the value of
- //the mustUnderstand attribute in the request.
- if (faultCodeElem == null)
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- else if (faultCodeElem.getNodeType() == Node.ELEMENT_NODE)
- {
- if (isValidFaultCode((Element) faultCodeElem))
- {
- result = AssertionResult.RESULT_PASSED;
- }
- else
- {
- result = AssertionResult.RESULT_WARNING;
- failureDetail =
- this.validator.createFailureDetail(responseMessage, entryContext);
- //failureDetail =
- // "The faultcode value was : "
- // + faultCodeElem.getFirstChild().getNodeValue().trim();
- } //End if (faultCode.equals...)
- }
- else
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- } //End for
- } //End if logEntryResponse!= null
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-
- /**
- * Check faultCode.
- * @param faultCodeElem a faultcode.
- * @return true if faultcode is valid.
- */
- public boolean isValidFaultCode(Element faultCodeElem)
- {
- //A faultcode may or maynot have a prefix, if it does its namespace should be
- //http://schemas.xmlsoap.org/soap/envelope which is the same as the faultcode element.
- //If a prefix is present and it corresponds to a different namespace or is null
- //then this returns false. The local part of the faultcode is then check to see
- //if it is one of the permitted values.
- if (faultCodeElem == null)
- return true;
-
- String faultCode = faultCodeElem.getFirstChild().getNodeValue().trim();
- if (faultCode == null)
- return false;
-
- // FIX: This is not correct, since this element can not be namespace qualified
- String faultCodeElemPrefix = faultCodeElem.getParentNode().getPrefix();
-
- // If this is not a QName then return false
- int index;
- String faultCodePrefix = null;
- String faultCodeName = faultCode;
- if ((index = faultCode.indexOf(':')) != -1)
- {
- faultCodePrefix = faultCode.substring(0, index);
- faultCodeName = faultCode.substring(index + 1, faultCode.length());
- }
-
- if ((faultCodeElemPrefix != null && faultCodePrefix != null))
- {
- if (faultCodePrefix.equals(faultCodeElemPrefix))
- {
- if ((faultCodeName.equals("MustUnderstand")
- || faultCodeName.equals("VersionMismatch")
- || faultCodeName.equals("Client")
- || faultCodeName.equals("Server")))
- /* REMOVE:
- || faultCodeName.startsWith("MustUnderstand.")
- || faultCodeName.startsWith("VersionMismatch.")
- || faultCodeName.startsWith("Client.")
- || faultCodeName.startsWith("Server.")))
- */
- return true;
- else
- return false;
- }
- else
- {
- return true;
- }
- }
- else
- {
- if (faultCodeName.equals("MustUnderstand")
- || faultCodeName.equals("VersionMismatch")
- || faultCodeName.equals("Client")
- || faultCodeName.equals("Server")
- || faultCodeName.startsWith("MustUnderstand.")
- || faultCodeName.startsWith("VersionMismatch.")
- || faultCodeName.startsWith("Client.")
- || faultCodeName.startsWith("Server."))
- return true;
- else
- return false;
- }
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1305.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1305.java
deleted file mode 100644
index 1c7976f5a..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1305.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.net.HttpURLConnection;
-import java.util.StringTokenizer;
-import java.util.Vector;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1305.
- * It is in an HTTP 500 message with "Server" Error code.
- */
-public class BP1305 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1305(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:Fault> element:
- NodeList faultList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_FAULT);
- if ((faultList == null) || (faultList.getLength() == 0))
- {
- // Response does not contain a soap:fault
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // we have a soap:Fault. Check that it is contained in a HTTP 500 message
- // GT : base HTTP Header parsing on BP1001 - this should be factored to a
- // general-purpose HTTP message parsing method or methods (request & response)
- String httpHeader = entryContext.getMessageEntry().getHTTPHeaders();
- //Response-Line = HTTP-Version ResponseCode ResponseMsg SP CRLF
- Vector responseLine = new Vector();
- String startLine = null;
- //String httpVersion = null;
- //String responseCode = null;
- String statusCode = null;
- StringTokenizer httpMessageTokenizer =
- new StringTokenizer(httpHeader, "\n\r\f");
-
- if (httpMessageTokenizer.hasMoreTokens())
- startLine = httpMessageTokenizer.nextToken();
-
- if (startLine.startsWith("HTTP"))
- {
- StringTokenizer startLineTokenizer =
- new StringTokenizer(startLine, "\u0020");
-
- while (startLineTokenizer.hasMoreTokens())
- {
- responseLine.add(startLineTokenizer.nextToken());
- }
-
- //httpVersion = (String) responseLine.get(0);
-
- // PB: Check for 500 status code which should be the second token in the string
- statusCode = (String) responseLine.get(1);
-
- //responseCode = (String) responseLine.get(1);
- //statusCode = (String) responseLine.get(2);
- }
- try
- {
- // PB: Just check for 500 status code
- if (!statusCode
- .equals(String.valueOf(HttpURLConnection.HTTP_INTERNAL_ERROR)))
- {
- //if (!responseCode.equalsIgnoreCase("OK") ||
- // (!statusCode.equalsIgnoreCase("ServerError"))) {
- // Assertion failed
- throw new AssertionFailException(httpHeader);
- }
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1306.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1306.java
deleted file mode 100644
index 13e40ed3d..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1306.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1306.
- * The soap:Fault element does not have children other than soap:faultcode, soap:faultstring, soap:faultactor or soap:detail.
- */
-public class BP1306 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1306(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:Fault> element:
- NodeList faultList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_FAULT);
- if ((faultList == null) || (faultList.getLength() == 0))
- {
- // Response does not contain a soap:fault
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // check that no soap:fault contains only faultcode, faultstring, faultactor, detail.
- // If it does, further check that it is unqualified.
- // For each <soap:Fault>
- try
- {
- for (int n = 0; n < faultList.getLength(); n++)
- {
- for (Node child = faultList.item(n).getFirstChild();
- child != null;
- child = child.getNextSibling())
- {
- if ((child.getNodeType() == Node.ELEMENT_NODE)
- && !(child
- .getLocalName()
- .equalsIgnoreCase(XMLUtils.SOAP_ELEM_FAULT_CODE)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_STRING)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_ACTOR)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_DETAIL)))
- {
- // PB: This is checked in 1316 now
- //|| (child.getNamespaceURI() != null)) {
- // Assertion failed
- throw new AssertionFailException(
- entryContext.getMessageEntry().getMessage());
- }
- }
- }
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1307.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1307.java
deleted file mode 100644
index f66dd616c..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1307.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1307.
- * The elements of the message that are namespaced
- * "http://schemas.xmlsoap.org/soap/envelope/" do not have a soap:encodingStyle attribute.
- */
-public class BP1307 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1307(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:xxx> elements:
- NodeList soapList =
- doc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "*");
- if ((soapList == null) || (soapList.getLength() == 0))
- {
- // Response does not contain any soap envelope elements
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // check that no <soap:xxx> elements contains a soap:encodingStyle attribute
- // For each <soap:xxx>
- try
- {
- for (int n = 0; n < soapList.getLength(); n++)
- {
- Element nextElem = (Element) soapList.item(n);
- if (nextElem
- .getAttributeNodeNS(WSIConstants.NS_URI_SOAP, "encodingStyle")
- != null)
- {
- // Assertion failed
- throw new AssertionFailException(
- entryContext.getMessageEntry().getMessage());
- }
- }
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1308.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1308.java
deleted file mode 100644
index ecc0a6fce..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1308.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.WSITag;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1308.
- * The children elements of soap:Body do not have a soap:encodingStyle attribute.
- */
-public class BP1308 extends AssertionProcess implements WSITag
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1308(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- throw new AssertionNotApplicableException();
-
- // look for soap:Body elements:
- NodeList soapBodyList = doc.getElementsByTagNameNS(
- ELEM_SOAP_BODY.getNamespaceURI(), ELEM_SOAP_BODY.getLocalPart());
-
- // The message does not contain any soap:Body, the assertion is not applicable
- if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
- throw new AssertionNotApplicableException();
-
- // check that no soap:Body child elements contain a soap:encodingStyle attribute
- // Getting the first soap:Body child element
- Element child =
- XMLUtils.getFirstChild((Element) soapBodyList.item(0));
- while (child != null)
- {
- if (child.getAttributeNodeNS(
- ELEM_SOAP_BODY.getNamespaceURI(), "encodingStyle") != null)
- {
- throw new AssertionFailException("The child element name is \"" +
- child.getNodeName() + "\".");
- }
- // Getting the next soap:Body child element
- child = XMLUtils.getNextSibling(child);
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1309.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1309.java
deleted file mode 100644
index fb3b6a4ba..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1309.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Vector;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1309.
- * The soap:Envelope does not have direct children after the soap:Body element
- */
-public class BP1309 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1309(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:Envelope> elements:
- // (Note: since this is a Soap message we expect exactly one soap envelope, but we do not assume it).
- NodeList soapEnvList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_ENVELOPE);
- if ((soapEnvList == null) || (soapEnvList.getLength() == 0))
- {
- // Response does not contain any soap Envelope element(s)
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // check that if a <soap:Body> exists in a <soap:Envelope>, that its the last in the envelope
- try
- {
- // For each <soap:Envelope>
- for (int n = 0; n < soapEnvList.getLength(); n++)
- {
- // Get the list of all elements in the Envelope
- Element soapEnv = (Element) soapEnvList.item(n);
- NodeList envChildList = soapEnv.getChildNodes();
- Vector envChildElemList = new Vector();
- for (int v = 0; v < envChildList.getLength(); v++)
- {
- Node nextNode = envChildList.item(v);
- if (nextNode.getNodeType() == Node.ELEMENT_NODE)
- {
- envChildElemList.addElement((Element) nextNode);
- }
- }
- // Search the list for <soap:Body>
- for (int m = 0; m < envChildElemList.size(); m++)
- {
- Element envChildElem = (Element) envChildElemList.elementAt(m);
- if (envChildElem
- .getNamespaceURI()
- .equals(WSIConstants.NS_URI_SOAP)
- && envChildElem.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY))
- {
- // found a <soap:Body> so check its the last in the list of child elements of the Envelope
- if (envChildElem != envChildElemList.lastElement())
- {
- throw new AssertionFailException(
- entryContext.getMessageEntry().getMessage());
- }
- }
- }
- }
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1316.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1316.java
deleted file mode 100644
index f84182f1b..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1316.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1316.
- * The soap:Fault element children (soap:faultcode, soap:faultstring, soap:faultactor or soap:detail) are unqualified.
- */
-public class BP1316 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1316(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
-
- Document doc;
- // Check if this is one way response
- // or message is mepty or invalid
- if (this.validator.isOneWayResponse(entryContext)
- || (doc = entryContext.getMessageEntryDocument()) == null)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // look for <soap:Fault> element:
- NodeList faultList =
- doc.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP,
- XMLUtils.SOAP_ELEM_FAULT);
- if ((faultList == null) || (faultList.getLength() == 0))
- {
- // Response does not contain a soap:fault
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- // check that no soap:fault contains only faultcode, faultstring, faultactor, detail.
- // If it does, further check that it is unqualified.
- // For each <soap:Fault>
- try
- {
- for (int n = 0; n < faultList.getLength(); n++)
- {
- for (Node child = faultList.item(n).getFirstChild();
- child != null;
- child = child.getNextSibling())
- {
- if ((child.getNodeType() == Node.ELEMENT_NODE)
- && (child
- .getLocalName()
- .equalsIgnoreCase(XMLUtils.SOAP_ELEM_FAULT_CODE)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_STRING)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_ACTOR)
- || child.getLocalName().equalsIgnoreCase(
- XMLUtils.SOAP_ELEM_FAULT_DETAIL))
- && (child.getNamespaceURI() != null))
- {
- // Assertion failed
- throw new AssertionFailException(
- entryContext.getMessageEntry().getMessage());
- }
- }
- }
- }
- catch (AssertionFailException e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1318.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1318.java
deleted file mode 100644
index a180801bd..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1318.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingOperation;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.HTTPUtils;
-import org.eclipse.wst.wsi.internal.core.util.OperationSignature;
-import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
-import org.eclipse.wst.wsi.internal.core.wsdl.WSDLUtils;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * BP1318
- *
- * The grandchildren elements of soap:Body do not have a soap:encodingStyle attribute.
- */
-public class BP1318 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1318(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- 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;
- failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext);
- }
- catch (AssertionNotApplicableException e)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1600.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1600.java
deleted file mode 100644
index e28c5b84e..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1600.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Collection;
-import java.util.HashSet;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-
-
-/**
- * BP1600
- *
- * <context>For a candidate envelope</context>
- * <assertionDescription>The envelope conforms to the structure specified in SOAP 1.1 Section 4.</assertionDescription>
- */
-public class BP1600 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1600(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion failed
- if (doc == null)
- {
- if (this.validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
- else
- throw new AssertionFailException("The log message is empty or invalid.");
- }
- // SOAP 1.1 specifications, Section 4.
- // http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383494
-
- // The namespace identifier for the elements and attributes defined
- // in this section is "http://schemas.xmlsoap.org/soap/envelope/".
-
- // o The Envelope is the top element of the XML document representing the message.
-
- // Rule 1. Envelope
- // o The element name is "Envelope".
- // o The element MUST be present in a SOAP message
- // o The element MAY contain namespace declarations as well as additional attributes.
- // If present, such additional attributes MUST be namespace-qualified. Similarly,
- // the element MAY contain additional sub elements. If present these elements
- // MUST be namespace-qualified and MUST follow the SOAP Body element.
-
- // Getting the top element
- Element element = doc.getDocumentElement();
-
- // Assuming that the top element should be soap:Envelope
- // If not, the assertion failed
- if (!element.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)
- || !isSOAPNamespace(element.getNamespaceURI()))
- throw new AssertionFailException("The top element is not soap:Envelope");
-
- // Collecting all the namespace declarations
- Collection envelopeNamespaces = collectNamespaces(element.getAttributes());
- envelopeNamespaces.add(WSIConstants.NS_URI_XMLNS);
-
- // Getting an attribute that is not in any of the namespaces
- Attr notValidAttr = getNotValidAttr(
- element.getAttributes(),
- envelopeNamespaces);
-
- // If found one, the assertion failed
- if (notValidAttr != null)
- throw new AssertionFailException("The attribute "
- + notValidAttr.getNodeName() + " is not namespace-qualified");
-
-
- // Rule 2. Header
- // o The element name is "Header".
- // o The element MAY be present in a SOAP message. If present, the element
- // MUST be the first immediate child element of a SOAP Envelope element.
- // o The element MAY contain a set of header entries each being an immediate
- // child element of the SOAP Header element. All immediate child elements
- // of the SOAP Header element MUST be namespace-qualified.
-
- // Getting the first sub element of the envelope
- element = XMLUtils.getFirstChild(element);
-
- // If the child is soap:Header
- if (element != null
- && element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER)
- && isSOAPNamespace(element.getNamespaceURI()))
- {
-
- // Going through all the Header entries
- Element headerEntry = XMLUtils.getFirstChild(element);
- while (headerEntry != null)
- {
- // Collecting all the namespaces for the current entry
- Collection headerEntryNamespaces = collectNamespaces(
- headerEntry.getAttributes());
-
- // If the entry is not in the namespaces, the assertion failed
- if (!envelopeNamespaces.contains(headerEntry.getNamespaceURI())
- && !headerEntryNamespaces.contains(headerEntry.getNamespaceURI()))
- throw new AssertionFailException("The header entry "
- + headerEntry.getNodeName() + " is not namespace-qualified");
-
- // Getting the next Header entry
- headerEntry = XMLUtils.getNextSibling(headerEntry);
- }
-
- // Getting the next sub element of the envelope
- element = XMLUtils.getNextSibling(element);
- }
-
-
- // Rule 3. Body
- // o The element name is "Body".
- // o The element MUST be present in a SOAP message and MUST be an immediate
- // child element of a SOAP Envelope element. It MUST directly follow the
- // SOAP Header element if present. Otherwise it MUST be the first immediate
- // child element of the SOAP Envelope element.
- // o The element MAY contain a set of body entries each being an immediate
- // child element of the SOAP Body element. Immediate child elements of the
- // SOAP Body element MAY be namespace-qualified. SOAP defines the SOAP Fault
- // element, which is used to indicate error messages.
-
- // if the SOAP Body element is not presented, the assertion failed
- if (element == null
- || !element.getLocalName().equals(XMLUtils.SOAP_ELEM_BODY)
- || !isSOAPNamespace(element.getNamespaceURI()))
- throw new AssertionFailException("The soap:Body element is not presented "
- + "or follows an additional sub element of soap:Envelope");
-
- // Processing all other sub elements of the envelope
- element = XMLUtils.getNextSibling(element);
- while (element != null)
- {
- // Checking for the SOAP Header element
- if (element.getLocalName().equals(XMLUtils.SOAP_ELEM_HEADER)
- && isSOAPNamespace(element.getNamespaceURI()))
- throw new AssertionFailException(
- "The soap:Header element cannot follow the soap:Body element");
-
- // Collecting all the namespaces for the current element
- Collection elementNamespaces = collectNamespaces(
- element.getAttributes());
-
- // If the element is not in the namespaces, the assertion failed
- if (!envelopeNamespaces.contains(element.getNamespaceURI())
- && !elementNamespaces.contains(element.getNamespaceURI()))
- throw new AssertionFailException("The sub envelope element "
- + element.getNodeName() + " is not namespace-qualified");
-
- // Getting the next sub element of the envelope
- element = XMLUtils.getNextSibling(element);
- }
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Collects all the namespace declarations from attributes collection
- * @param attrs an attributes collection
- * @return a collection of namespaces
- */
- private Collection collectNamespaces(NamedNodeMap attrs)
- {
- Collection ns = new HashSet();
- if (attrs != null)
- {
- for(int i = 0; i < attrs.getLength(); i++)
- {
- Attr attr = (Attr) attrs.item(i);
- if (attr.getNamespaceURI() != null
- && attr.getNamespaceURI().equals(WSIConstants.NS_URI_XMLNS))
- ns.add(attr.getValue());
- }
- }
-
- return ns;
- }
-
- /**
- * Retrieves an attribute that is not in namespaces
- * @param attrs an attributes collection
- * @param ns a namespaces collection
- * @return an attribtue that is not in any of the namespaces specified
- */
- private Attr getNotValidAttr(NamedNodeMap attrs, Collection ns)
- {
- Attr ret = null;
- if (attrs != null)
- {
- for(int i = 0; i < attrs.getLength(); i++)
- {
- Attr attr = (Attr) attrs.item(i);
- if (attr.getNamespaceURI() == null
- || !ns.contains(attr.getNamespaceURI()))
- {
- ret = attr;
- break;
- }
- }
- }
- return ret;
- }
-
- /**
- * Qualifies whether a namespace is the SOAP namespace
- * "http://schemas.xmlsoap.org/soap/envelope/"
- * @param ns a namespace to be qualified
- * @return true if the namespace is qualified, false otherwise
- */
- private boolean isSOAPNamespace(String ns)
- {
- if (ns == null)
- return false;
-
- return ns.equals(WSIConstants.NS_URI_SOAP);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1601.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1601.java
deleted file mode 100644
index 78e7c4545..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1601.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.xml.sax.SAXException;
-
-
-/**
- * BP1601.
- */
-public class BP1601 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1601(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- // One-way responses will not contain a SOAP message
- if (this.validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- try
- {
- // Try to parse the SOAP message
- //Document doc = XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
- XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
- }
- catch (WSIException e)
- {
- if (e.getTargetException() instanceof SAXException)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- this.validator.createFailureDetail(
- e.getTargetException().getMessage(),
- entryContext);
- }
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1701.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1701.java
deleted file mode 100644
index cca1c8958..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1701.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.util.TestUtils;
-import org.eclipse.wst.wsi.internal.core.util.Utils;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import com.ibm.wsdl.util.xml.DOM2Writer;
-
-
-/**
- * BP1701.
- */
-public class BP1701 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1701(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- if (this.validator.isOneWayResponse(entryContext))
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- else
- {
- try
- {
- // TEMP: Use local copy of schema for now
- // Document doc = XMLUtils.parseXML(entryContext.getLogEntry().getMessage(), WSIConstants.NS_URI_SOAP);
- // Document doc = XMLUtils.parseXML(entryContext.getLogEntry().getMessage(), "schemas/soapEnvelope.xsd");
-
- // Get a non-validated but (well-formed) DOM tree of the message content
- Document doc =
- XMLUtils.parseXML(entryContext.getMessageEntry().getMessage());
-
- // Remove any xsi:types attributes from the message (SOAP Header, Body and Envelope itself)
-
- NodeList elementList = doc.getElementsByTagName("*");
- if (elementList != null)
- {
- for (int i = 0; i < elementList.getLength(); i++)
- {
- Element element = (Element) elementList.item(i);
- element.removeAttributeNS(WSIConstants.NS_URI_XSI, "type");
- }
- }
-
- // Write out the (potentially) modified tree to String
- String filteredMessage = DOM2Writer.nodeToString(doc);
-
- // Parse the result with validation "on"
- XMLUtils.parseXML(
- filteredMessage,
- TestUtils.getSOAPSchemaLocation());
- }
- catch (WSIException e)
- {
- if (e.getTargetException() instanceof SAXException)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- this.validator.createFailureDetail(
- Utils.getExceptionDetails(e.getTargetException()),
- entryContext);
- }
- }
- catch (Exception e)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail =
- this.validator.createFailureDetail(Utils.getExceptionDetails(e), entryContext);
- }
- }
-
- // Return assertion result
- return validator.createAssertionResult(testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1755.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1755.java
deleted file mode 100644
index 7b83ee2dc..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP1755.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.BindingOperation;
-import javax.xml.namespace.QName;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * BP1755
- *
- * <context>For a candidate non-fault envelope containing a soap:body with at least one element, and that is referred by a binding style RPC-literal</context>
- * <assertionDescription>Each part accessor element in the envelope has a local name of the same value as the name attribute of the corresponding wsdl:part element.</assertionDescription>
- */
-public class BP1755 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP1755(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- if (validator.isOneWayResponse(entryContext))
- throw new AssertionNotApplicableException();
-
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
-
- Element soapOperation = null;
- // If there is a Fault entry or no body entries,
- // the assertion is not applicable
- if (validator.isFault(doc)
- || (soapOperation = validator.getSoapBodyChild(doc)) == null)
- throw new AssertionNotApplicableException();
-
- // Creating a qualified name of potential SOAP operation
- QName operationQName = new QName(
- soapOperation.getNamespaceURI(), soapOperation.getLocalName());
-
- // Retrieving all the RPC binding operations from wsdl:binding
- BindingOperation[] rpcBindingOperations =
- validator.getMatchingBindingOps(
- WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
- validator.analyzerContext.getCandidateInfo().getBindings());
-
- // Retrieving binding operation by given operation name
- BindingOperation bindingOperation = validator.getOperationMatch(
- entryContext.getEntry().getEntryType(),
- operationQName,
- rpcBindingOperations);
-
- // If there is no matched operation, the assertion is not applicable
- if (bindingOperation == null)
- throw new AssertionNotApplicableException();
-
- // Finding operation message parts and extensibility elems
- // in the binding depending on message type
- List operationMessageParts = null;
- List extElems = null;
- if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_REQUEST))
- {
- operationMessageParts = bindingOperation.getOperation()
- .getInput().getMessage().getOrderedParts(null);
- if (bindingOperation.getBindingInput() != null)
- extElems =
- bindingOperation.getBindingInput().getExtensibilityElements();
- }
- else
- {
- operationMessageParts = bindingOperation.getOperation()
- .getOutput().getMessage().getOrderedParts(null);
- if (bindingOperation.getBindingOutput() != null)
- extElems =
- bindingOperation.getBindingOutput().getExtensibilityElements();
- }
-
- // If the message is not literal, the assertion is not applicable
- if (!validator.isLiteral(extElems))
- throw new AssertionNotApplicableException();
-
-
- /* Basic Profile Version 1.1 (http://www.ws-i.org/Profiles/Basic/2003-12/BasicProfile-1.1.htm)
- * says that the order of the elements in the soap:body of an ENVELOPE MUST be
- * the same as that of the wsdl:parts in the wsdl:message that describes it.
- * However, we should keep in mind there is the "parts" attribute of soapbind:body
- * that indicates which parts appear within the SOAP Body.
- */
-
- // Getting the ordered list of wsdl:part names
- List orderedPartNames =
- validator.orderPartNames(operationMessageParts, extElems);
- Iterator i = orderedPartNames.iterator();
- // Getting the first accessor
- Element accessor = XMLUtils.getFirstChild(soapOperation);
- while (accessor != null)
- {
- // If there is no the corresponding wsdl:part element
- // for an accessor, the assertion failed
- if (!i.hasNext())
- throw new AssertionFailException(
- "The part accessor element '" + accessor.getLocalName()
- + "' does not have the corresponding wsdl:part element.");
-
- // If local name of accessor does not equal to the name of the
- // corresponding wsdl:part element, the assertion failed
- String partName = (String) i.next();
- if (!accessor.getLocalName().equals(partName))
- throw new AssertionFailException(
- "The accessor local name is " + accessor.getLocalName()
- + ", the corresponding part element name is " + partName);
-
- // Getting the next accessor
- accessor = XMLUtils.getNextSibling(accessor);
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_FAILED;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4100.java
deleted file mode 100644
index fe09c0002..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4100.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import java.util.Iterator;
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.extensions.ExtensibilityElement;
-import javax.wsdl.extensions.soap.SOAPHeader;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.log.MessageEntry;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-
-/**
- * BP4100
- * <context>For a candidate envelope containing a header block that is either mandatory or is not described in the wsdl:binding.</context>
- * <assertionDescription>An envelope contains a header block that is either mandatory or is not described in the wsdl:binding.</assertionDescription>
- */
-public class BP4100 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP4100(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // Parsing the message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting header elements from envelope
- Element root = doc.getDocumentElement();
- NodeList headerList = root.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_HEADER);
-
- // If there is no header, the assertion is not applicable
- if (headerList == null || headerList.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the header element
- Node header = headerList.item(0);
-
- // Getting the immediate child elements of the header
- NodeList elems = header.getChildNodes();
-
- // If there are no child elements of the header
- // the assertion is not applicable
- if (elems == null || elems.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Walking through child elements
- for (int i = 0; i < elems.getLength(); i++)
- {
-
- if (elems.item(i).hasAttributes())
- {
- // Getting the mustUnderstand attribute
- Node muNode = elems.item(i).getAttributes().getNamedItem(
- root.getPrefix() + ":" + XMLUtils.SOAP_ATTR_MUST_UNDERSTAND);
- // If a header block is mandatory, then the assertion passed
- if (muNode != null && muNode.getNodeValue().equals("1"))
- {
- throw new AssertionPassException();
- }
- }
-
- // Getting header block name
- String blockName = elems.item(i).getLocalName();
- // If the name is not presented (occurs when element is empty string)
- // then continue with the next element
- if (blockName == null)
- {
- continue;
- }
-
- boolean blockNameExists = false;
-
- // Getting WSDL bindings
- Binding[] bindings = validator.getWSDLDocument().getBindings();
- for (int j = 0; j < bindings.length; j++)
- {
- // Getting wsdl:operations
- List operations = bindings[j].getBindingOperations();
- Iterator k = operations.iterator();
- while (k.hasNext() && !blockNameExists)
- {
- BindingOperation operation = (BindingOperation) k.next();
-
- // If this is a request message,
- // then getting wsdl:input for an operation
- if (entryContext.getMessageEntry().getType().equals(
- MessageEntry.TYPE_REQUEST))
- {
- BindingInput opInput = operation.getBindingInput();
- if (opInput != null)
- {
- // If wsdl:input is presented then checking
- // whether the block name is described there or not
- blockNameExists = blockNameExists(
- opInput.getExtensibilityElements(), blockName);
- }
- }
- // If this is a response message,
- // then getting wsdl:output for an operation
- else
- {
- BindingOutput opOutput = operation.getBindingOutput();
- if (opOutput != null)
- {
- // If wsdl:output is presented then checking
- // whether the block name is described there or not
- blockNameExists = blockNameExists(
- opOutput.getExtensibilityElements(), blockName);
- }
- }
- }
- }
-
- // If a header block is not described in the appropriate wsdl:binding
- // then the assertion passed
- if (!blockNameExists)
- {
- throw new AssertionPassException();
- }
- }
-
- // No one header block is either mandatory or is not described in the
- // appropriate wsdl:binding, the assertion is not applicable
- result = AssertionResult.RESULT_NOT_APPLICABLE;
-
- }
- catch (AssertionPassException ape)
- {
- failureDetail = validator.createFailureDetail(
- testAssertion.getDetailDescription(), entryContext);
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Checks the existense of blockName in wsdlsoap:header, if it is found in
- * a list of ExtensibilityElement objects
- *
- * @param elems A list of ExtensibilityElement objects
- * @param blockName The name that will be checked for existence
- * @return true if blockName is described in the wsdlsoap:header extensibility element
- */
- private boolean blockNameExists(List elems, String blockName)
- {
- if (elems == null)
- {
- return false;
- }
-
- Iterator i = elems.iterator();
- while (i.hasNext())
- {
- ExtensibilityElement elem = (ExtensibilityElement) i.next();
- String elemName = elem.getElementType().getLocalPart();
- if (elemName.equals("header"))
- {
- SOAPHeader soapHeader = (SOAPHeader) elem;
- if (soapHeader.getPart().equals(blockName))
- {
- return true;
- }
- }
- }
-
- return false;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4101.java
deleted file mode 100644
index afd93f3f4..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4101.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * BP4101
- * <context>For a candidate envelope containing a soap:actor attribute with a value other than the special uri "http://schemas.xmlsoap.org/soap/actor/next".</context>
- * <assertionDescription>A header element in the envelope contains a soap:actor attribute with a value other than the special uri "http://schemas.xmlsoap.org/soap/actor/next".</assertionDescription>
- */
-public class BP4101 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP4101(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try {
-
- // Parsing the message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting header elements from envelope
- Element root = doc.getDocumentElement();
- NodeList headerList = root.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_HEADER);
-
- // If there is no header, the assertion is not applicable
- if (headerList == null || headerList.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the header element
- Node header = headerList.item(0);
-
- // Getting the immediate child elements of the header
- NodeList elems = header.getChildNodes();
-
- // If there is no child elements of the header
- // the assertion is not applicable
- if (elems == null || elems.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Walking through child elements
- for (int i = 0; i < elems.getLength(); i++)
- {
- // Getting node attributes
- NamedNodeMap attrs = elems.item(i).getAttributes();
-
- // If the node does not have attributes then continue
- if (attrs == null)
- {
- continue;
- }
-
- // Getting actor attribute
- Node actor = attrs.getNamedItem(root.getPrefix()
- + ":" + XMLUtils.SOAP_ATTR_ACTOR);
-
- // If the actor attribute is presented and does not equal
- // to "http://schemas.xmlsoap.org/soap/actor/next",
- // then the assertion passed
- if (actor != null
- && !actor.getNodeValue().equals(WSIConstants.NS_URI_SOAP_NEXT_ACTOR))
- {
- throw new AssertionPassException();
- }
- }
-
- // No one actor attribute has a value other than
- // "http://schemas.xmlsoap.org/soap/actor/next",
- // the assertion is not applicable
- result = AssertionResult.RESULT_NOT_APPLICABLE;
-
- }
- catch (AssertionPassException ape)
- {
- failureDetail = validator.createFailureDetail(
- testAssertion.getDetailDescription(), entryContext);
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4102.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4102.java
deleted file mode 100644
index 1be179229..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4102.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-/**
- * BP4102
- * <context>For a candidate envelope containing a fault with a non-empty detail element.</context>
- * <assertionDescription>A Fault element in an envelope contains a non-empty detail element.</assertionDescription>
- */
-public class BP4102 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP4102(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try {
-
- // Parsing the message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting Fault elements from envelope
- Element root = doc.getDocumentElement();
- NodeList faultList = root.getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_FAULT);
-
- // If there is no Fault element, the assertion is not applicable
- if (faultList == null || faultList.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Fault element must not appear more than once
- // within a Body element, so getting the first one
- Element fault = (Element) faultList.item(0);
-
- // Getting Fualt's detail elements
- NodeList details = fault.getElementsByTagName(
- XMLUtils.SOAP_ELEM_FAULT_DETAIL);
- // If there is a non-empty detail element, then the assertion passed
- if (details != null
- && details.getLength() > 0)
- {
- NodeList list = details.item(0).getChildNodes();
- // search first element node
- for (int i = 0; i < list.getLength(); i++)
- {
- if((list.item(i).getNodeType() == Node.ELEMENT_NODE)
- && (list.item(i).getLocalName() != null) )
- {
- throw new AssertionPassException();
- }
- }
- }
-
- // There is no detail element in Fault,
- // the assertion is not applicable
- result = AssertionResult.RESULT_NOT_APPLICABLE;
-
- }
- catch (AssertionPassException ape)
- {
- failureDetail = validator.createFailureDetail(
- testAssertion.getDetailDescription(), entryContext);
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4109.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4109.java
deleted file mode 100644
index 92f8d1d37..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/BP4109.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.NodeList;
-
-/**
- * BP4109
- *
- * <context>For a candidate envelope containing a soap:Body element with attributes</context>
- * <assertionDescription>An envelope contains a a soap:Body element with attributes.</assertionDescription>
- */
-public class BP4109 extends AssertionProcess {
-
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public BP4109(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try {
-
- // Parsing the message
- Document doc = entryContext.getMessageEntryDocument();
-
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the soap:Body elements from envelope
- NodeList bodyList = doc.getDocumentElement().getElementsByTagNameNS(
- WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_BODY);
-
- // If there is no Body element, the assertion is not applicable
- if (bodyList == null || bodyList.getLength() == 0)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the first soap:Body element
- Element body = (Element) bodyList.item(0);
-
- // If the Body element has attributes (excluding namespace declarations),
- // the assertion passed
- NamedNodeMap attrs = body.getAttributes();
- if (attrs != null)
- {
- for (int i = 0; i < attrs.getLength(); i++)
- {
- String attrName = ((Attr) attrs.item(i)).getName();
- if (!attrName.equals("xmlns") && !attrName.startsWith("xmlns:"))
- {
- throw new AssertionPassException();
- }
- }
- }
-
- throw new AssertionNotApplicableException();
- }
- catch (AssertionPassException ape)
- {
- failureDetail = validator.createFailureDetail(
- testAssertion.getDetailDescription(), entryContext);
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
-
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/EnvelopeValidatorImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/EnvelopeValidatorImpl.java
deleted file mode 100644
index be2014cb0..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/EnvelopeValidatorImpl.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2003 IBM Corporation, Parasoft and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- * Parasoft - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EnvelopeValidator;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.util.EntryType;
-
-/**
- * @version 1.0
- */
-public class EnvelopeValidatorImpl
- extends BaseMessageValidator
- implements EnvelopeValidator
-{
- /* (non-Javadoc)
- * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext)
- */
- protected boolean isPrimaryEntryTypeMatch(
- TestAssertion testAssertion,
- EntryContext entryContext)
- {
- boolean match = false;
-
- // Verify that the entry and test assertion have the same primary context
- if ((testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_ANY))
- || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_REQUEST)
- && (entryContext
- .getEntry()
- .getEntryType()
- .getTypeName()
- .equals(EntryType.TYPE_MESSAGE_REQUEST)))
- || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_ENVELOPE_RESPONSE)
- && (entryContext
- .getEntry()
- .getEntryType()
- .getTypeName()
- .equals(EntryType.TYPE_MESSAGE_RESPONSE))))
- {
- match = true;
- }
-
- return match;
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP1601.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP1601.java
deleted file mode 100644
index 919d35aca..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP1601.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-
-/**
- * SSBP1601
- */
-public class SSBP1601 extends BP1601
-{
-
- /**
- * @param BaseMessageValidator
- */
- public SSBP1601(BaseMessageValidator impl)
- {
- super(impl);
- }
-} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP9704.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP9704.java
deleted file mode 100644
index ac5526f31..000000000
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/envelope/SSBP9704.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002-2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM - Initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope;
-
-import org.eclipse.wst.wsi.internal.core.WSIConstants;
-import org.eclipse.wst.wsi.internal.core.WSIException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
-import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException;
-import org.eclipse.wst.wsi.internal.core.profile.TestAssertion;
-import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess;
-import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator;
-import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
-import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-/**
- * SSBP9704
- *
- * <context>For a candidate envelope</context>
- * <assertionDescription>The ENVELOPE does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
- */
-public class SSBP9704 extends AssertionProcess
-{
- private final BaseMessageValidator validator;
-
- /**
- * @param BaseMessageValidator
- */
- public SSBP9704(BaseMessageValidator impl)
- {
- super(impl);
- this.validator = impl;
- }
-
- public AssertionResult validate(
- TestAssertion testAssertion,
- EntryContext entryContext)
- throws WSIException
- {
- try
- {
- // Getting a message document
- Document doc = entryContext.getMessageEntryDocument();
- // If the message is empty or invalid, the assertion is not applicable
- if (doc == null)
- {
- throw new AssertionNotApplicableException();
- }
-
- // Getting the root element
- Element elem = doc.getDocumentElement();
- // If it is not the soap:Envelope, the assertion is not applicable
- if (!elem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP)
- || !elem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
- {
- throw new AssertionNotApplicableException();
- }
-
- // If the envelope contains the xmlns:xml namespace declaration,
- // the assertion failed
- String incorrectElementName = getIncorrectElementName(elem);
- if (incorrectElementName != null)
- {
- throw new AssertionFailException("The name of an element containing "
- + "such namespace declaration is \"" + incorrectElementName + "\".");
- }
- }
- catch (AssertionNotApplicableException anae)
- {
- result = AssertionResult.RESULT_NOT_APPLICABLE;
- }
- catch (AssertionFailException afe)
- {
- result = AssertionResult.RESULT_WARNING;
- failureDetail = validator.createFailureDetail(
- afe.getMessage(), entryContext);
- }
-
- // Return assertion result
- return validator.createAssertionResult(
- testAssertion, result, failureDetail);
- }
-
- /**
- * Looks for any element that contains the attribute xmlns:xml="http://www.w3.org/XML/1998/namespace".
- * @param elem the root element.
- * @return the name of an element found or null.
- */
- private String getIncorrectElementName(Element elem)
- {
- // Getting a value of the attribute xmlns:xml
- String attrValue = elem.getAttributeNS(
- WSIConstants.NS_URI_XMLNS, "xml");
- // If it equals to "http://www.w3.org/XML/1998/namespace",
- // return an element name;
- if (WSIConstants.NS_URI_XML.equals(attrValue))
- {
- return elem.getNodeName();
- }
- // Going through element's children
- Element child = XMLUtils.getFirstChild(elem);
- while (child != null)
- {
- // If any of them has xmlns:xml attribute, return a value
- String name = getIncorrectElementName(child);
- if (name != null)
- {
- return name;
- }
- // Getting the next element's child
- child = XMLUtils.getNextSibling(child);
- }
- // No xmlns:xml attributes found, return null
- return null;
- }
-} \ No newline at end of file

Back to the top