Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl')
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2901.java146
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2903.java241
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2904.java47
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2906.java216
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2907.java52
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2908.java297
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2909.java215
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2910.java230
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2911.java228
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2930.java136
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2940.java450
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2941.java341
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2944.java234
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2946.java194
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2010.java119
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2011.java341
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2012.java123
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2013.java91
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2014.java286
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2017.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2018.java127
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2019.java122
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2020.java162
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2021.java112
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2022.java82
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2023.java85
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2032.java86
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2034.java94
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2098.java69
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2101.java116
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2102.java203
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2103.java130
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2104.java100
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2105.java232
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2107.java200
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2108.java94
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2110.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2111.java142
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2112.java203
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2113.java159
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2114.java278
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2115.java97
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2116.java88
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2117.java183
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2118.java98
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2119.java165
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2120.java247
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2121.java174
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2122.java95
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2123.java357
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2201.java189
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2202.java420
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2208.java72
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2402.java69
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2404.java76
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2406.java166
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2416.java209
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2417.java160
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2700.java82
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2701.java89
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2703.java111
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2803.java87
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4200.java162
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4201.java144
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4202.java131
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2209.java29
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2402.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2403.java191
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSDLValidatorImpl.java2314
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2010.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2011.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2012.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2013.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2014.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2017.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2018.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2019.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2020.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2021.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2022.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2032.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2098.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2099.java157
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2100.java171
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2101.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2102.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2103.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2104.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2105.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2107.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2108.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2110.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2111.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2112.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2113.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2114.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2115.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2116.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2117.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2118.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2119.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2120.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2122.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2123.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2201.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2202.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2208.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2402.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2403.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2404.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2406.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2416.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2417.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2700.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2701.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2703.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4200.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4201.java26
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4202.java26
119 files changed, 14830 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2901.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2901.java
new file mode 100644
index 000000000..42e561f7f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2901.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Collection;
+import java.util.HashSet;
+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.xml.namespace.QName;
+
+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.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.report.AssertionResult;
+
+/**
+ * AP2901
+ *
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>A description uses either the WSDL MIME Binding as described in WSDL 1.1 Section 5
+ * or WSDL SOAP binding as described in WSDL 1.1 Section 3
+ * on each of the wsdl:input or wsdl:output elements of a wsdl:binding. </assertionDescription>
+ */
+public class AP2901 extends AssertionProcess implements WSITag
+{
+ /**
+ * WSDLValidator
+ */
+ private final WSDLValidatorImpl validator;
+
+ private Collection mimeElements;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2901(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+
+ mimeElements = new HashSet();
+ mimeElements.add(WSDL_MIME_CONTENT);
+ mimeElements.add(WSDL_MIME_XML);
+ mimeElements.add(WSDL_MIME_MULTIPART);
+ }
+
+ /* 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
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ QName inapplicableElement = null;
+ // Getting an inapplicable extensibility element of wsdl:input
+ // If such element exists, the assertion failed
+ if (bindingInput != null)
+ {
+ // Getting an inapplicable extensibility element of wsdl:input
+ // If such element exists, the assertion failed
+ inapplicableElement = getInapplicableElement(bindingInput.getExtensibilityElements());
+
+ if (inapplicableElement != null)
+ throw new AssertionFailException(inapplicableElement.toString());
+ }
+
+ // Getting an inapplicable extensibility element of wsdl:output
+ // If such element exists, the assertion failed
+ if (bindingOutput != null)
+ {
+ inapplicableElement =
+ getInapplicableElement(bindingOutput.getExtensibilityElements());
+ if (inapplicableElement != null)
+ throw new AssertionFailException(inapplicableElement.toString());
+ }
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for any extensibility element of wsdl:input or wsdl:output
+ * that does not conform to the SOAP binding or the MIME binding.
+ * @param extElems a list of extensibility elements
+ * @return the QName of an inapplicable element
+ */
+ private QName getInapplicableElement(List extElems)
+ {
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ QName elementName =
+ ((ExtensibilityElement) extElems.get(i)).getElementType();
+
+ if (!mimeElements.contains(elementName) &&
+ !elementName.equals(WSDL_SOAP_BODY) &&
+ !elementName.equals(WSDL_SOAP_HEADER))
+ {
+ return elementName;
+ }
+ }
+
+ 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/wsdl/AP2903.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2903.java
new file mode 100644
index 000000000..02bc31357
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2903.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2903
+ *
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>The part attribute of each mime:content element in a wsdl:binding references
+ * a wsdl:part element of a wsdl:message that is present in the respective wsdl:input or wsdl:output of the
+ * corresponding wsdl:operation of the corresponding wsdl:portType.</assertionDescription>
+ */
+public class AP2903 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2903(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If there is no the corresponding wsdl:input in wsdl:portType,
+ // the assertion failed
+ if (portTypeInput == null)
+ throw new AssertionFailException(
+ "There is no the corresponging wsdl:input in the wsdl:portType"
+ + " operation for the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+
+ // If the wsdl:portType input does not reference any wsdl:message,
+ // the assertion failed
+ if (portTypeInput.getMessage() == null)
+ throw new AssertionFailException("The wsdl:input of the \""
+ + bindingOperation.getOperation().getName() + "\" wsdl:portType "
+ + "operation does not reference any wsdl:message.");
+
+ // Getting the part name that is not specified in the wsdl:message
+ // the input of wsdl:portType refers to
+ String part = getInvalidMimeContentPart(
+ inputMimeContents, portTypeInput.getMessage());
+
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the input of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If there is no the corresponding wsdl:input in wsdl:portType,
+ // the assertion failed
+ if (portTypeOutput == null)
+ throw new AssertionFailException(
+ "There is no the corresponging wsdl:output in the wsdl:portType"
+ + " operation for the wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+
+ // If the wsdl:portType output does not reference any wsdl:message,
+ // the assertion failed
+ if (portTypeOutput.getMessage() == null)
+ throw new AssertionFailException("The wsdl:output of the \""
+ + bindingOperation.getOperation().getName() + "\" wsdl:portType "
+ + "operation does not reference any wsdl:message.");
+
+ // Getting the part name that is not specified in the wsdl:message
+ // the output of wsdl:portType refers to
+ String part = getInvalidMimeContentPart(
+ outputMimeContents, portTypeOutput.getMessage());
+
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the output of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+ }
+
+ // If the binding contains no mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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 all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+
+ /**
+ * Returns part name specified in mime:content element that is not presented in wsdl:message
+ * @param mimeContents a list of mime:content elements which part attributes are validated
+ * @param message a wsdl:message
+ * @return a part name
+ */
+ private String getInvalidMimeContentPart(List mimeContents, Message message)
+ {
+ // Going throug all the mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // Getting the part name of a mime:element
+ String part = ((MIMEContent) mimeContents.get(i)).getPart();
+ // If the wsdl:message does not contain such part, return the part
+ if (!message.getParts().keySet().contains(part))
+ return part;
+ }
+ // Return null if no one part is found
+ 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/wsdl/AP2904.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2904.java
new file mode 100644
index 000000000..c5a9716e3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2904.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+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.report.AssertionResult;
+
+/**
+ * AP2904
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>The part attribute of each mime:content element in a wsdl:binding
+ * does not reference a sub-component of a wsdl:part of the wsdl:message that is present in the
+ * respective wsdl:input or wsdl:output of the corresponding wsdl:operation of the corresponding
+ * wsdl:portType.</assertionDescription>
+ */
+public class AP2904 extends AP2903
+{
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2904(WSDLValidatorImpl impl)
+ {
+ super(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
+ {
+ // Return assertion result
+ return super.validate(testAssertion, entryContext);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2906.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2906.java
new file mode 100644
index 000000000..2c9c7cd72
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2906.java
@@ -0,0 +1,216 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+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.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2906
+ *
+ * <context>For a candidate wsdl:binding containing a mime:multipartRelated element</context>
+ * <assertionDescription>A non-root MIME part in a wsdl:binding does not contain a soapbind:header element.</assertionDescription>
+ */
+public class AP2906 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2906(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMultiparts = getMimeMultipartElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a soap:header in the non-root mime:part,
+ // the assertion failed
+ if (containsInvalidMimePart(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a soap:header in the non-root mime:part,
+ // the assertion failed
+ if (containsInvalidMimePart(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Looks for such non-root mime:part element from a list of mime:multipartRelated elements
+ * that contains a soap:header element.
+ * @param multiparts a list of mime:multipartRelated elements
+ * @return true, if such element is found, false otherwise
+ */
+ private boolean containsInvalidMimePart(List multiparts)
+ {
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ ((MIMEMultipartRelated) multiparts.get(i)).getMIMEParts();
+
+ // Looking for non-root mime:partS
+ if (mimeParts.size() > 1)
+ {
+ for (int j = 1; j < mimeParts.size(); j++)
+ {
+ // Getting a list of extensibility elements of a mime:part
+ List extElems =
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements();
+ // Going through the extensibility elements
+ for (int k = 0; k < extElems.size(); k++)
+ {
+ // If an extensibility element is a soap:header,
+ // return true
+ if (((ExtensibilityElement)extElems.get(k))
+ .getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+ // return false, if the element is not found
+ return false;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param extElems a list of extensibility elements that can contain mime:multipartRelated elements.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(List extElems)
+ {
+ List mimeMultipartElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(extElem);
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2907.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2907.java
new file mode 100644
index 000000000..494445f6c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2907.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+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.report.AssertionResult;
+
+/**
+ * AP2907
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Each MIME part in a description is defined using
+ * an element with a local name of part in the namespace of the
+ * WSDL MIME Binding extension.</assertionDescription>
+ */
+public class AP2907 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2907(WSDLValidatorImpl 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
+ {
+ // 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/wsdl/AP2908.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2908.java
new file mode 100644
index 000000000..5208c8af3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2908.java
@@ -0,0 +1,297 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+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.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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * AP2908
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The mime:part element in a DESCRIPTION does not have a name attribute.</assertionDescription>
+ */
+public class AP2908 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2908(WSDLValidatorImpl 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
+ {
+ // Getting a wsdl:binding
+ Binding wsdlBinding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Since WSDL4J 1.4 ignores any attributes of mime:part, use Xerces 2.6.2 instead
+ Document doc = XMLUtils.parseXMLDocument(validator.wsdlURL);
+
+ // Finding the wsdl:binding element being processed
+ Element binding = getBindingElement(
+ doc.getDocumentElement(), wsdlBinding.getQName().getLocalPart());
+
+ List ops = getChildElements(binding, WSDL_OPERATION);
+
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ Element bindingOperation = (Element) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ Element bindingInput = getChildElement(bindingOperation, WSDL_INPUT);
+ Element bindingOutput = getChildElement(bindingOperation, WSDL_OUTPUT);
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(bindingInput);
+ List outputMultiparts = getMimeMultipartElements(bindingOutput);
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a mime:part element containing a name attribute,
+ // the assertion failed
+ if (containsInvalidMimePart(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:part element is in the wsdl:input of the \""
+ + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
+ + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is a mime:part element containing a name attribute,
+ // the assertion failed
+ if (containsInvalidMimePart(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:part element is in the wsdl:output of the \""
+ + bindingOperation.getAttribute(WSIConstants.ATTR_NAME)
+ + "\" binding operation.");
+ }
+ }
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (IOException ioe)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ 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);
+ }
+
+ /**
+ * Validates mime:part elements for each of mime:multipartRelated element.
+ * @param multiparts a list of mime:multipartRelated elements.
+ * @return true, if any mime:part contains a name attribute, false otherwise.
+ */
+ private boolean containsInvalidMimePart(List multiparts) {
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ getChildElements((Element) multiparts.get(i), WSDL_MIME_PART);
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ Element mimePart = (Element) mimeParts.get(j);
+ // If the mime:part element contains a name attribute,
+ // return true
+ if (mimePart.getAttributeNode(WSIConstants.ATTR_NAME) != null)
+ {
+ return true;
+ }
+ }
+ }
+ // No one invalid mime:part element is found, return false
+ return false;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param parent an element which the child elements are gathered from.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(Element parent)
+ {
+ List mimeMultipartElements = new ArrayList();
+ // If the parent is not null
+ if (parent != null)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child is a mime:multipartRelated element
+ if (child.getNamespaceURI().equals(WSDL_MIME_MULTIPART.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_MIME_MULTIPART.getLocalPart()))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(child);
+
+ // Getting mime:partS from the element
+ List mimeParts = getChildElements(child, WSDL_MIME_PART);
+ // Going through all the mime:part elements
+ for (int i = 0; i < mimeParts.size(); i++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements((Element) mimeParts.get(i));
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ // Getting the next child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+
+ /**
+ * Looks for an element's child element.
+ * @param parent a parent element.
+ * @param childName a qualified element name being found.
+ * @return an element or null if it is not found.
+ */
+ private Element getChildElement(Element parent, QName childName)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child has the required qualified name
+ if (child.getNamespaceURI().equals(childName.getNamespaceURI())
+ && child.getLocalName().equals(childName.getLocalPart()))
+ {
+ // return the child
+ return child;
+ }
+ // Getting the next child
+ child = XMLUtils.getNextSibling(child);
+ }
+ return null;
+ }
+
+ /**
+ * Collects element's child elements.
+ * @param parent a parent element.
+ * @param childName a qualified element name being found.
+ * @return a list of elements found.
+ */
+ private List getChildElements(Element parent, QName childName)
+ {
+ List children = new ArrayList();
+ if (parent != null)
+ {
+ // Getting the first parent's child
+ Element child = XMLUtils.getFirstChild(parent);
+ while (child != null)
+ {
+ // If the child has the required qualified name
+ if (child.getNamespaceURI().equals(childName.getNamespaceURI())
+ && child.getLocalName().equals(childName.getLocalPart()))
+ {
+ // Adding the child to the list
+ children.add(child);
+ }
+ // Getting the next binding's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+ return children;
+ }
+
+ /**
+ * Looks for wsdl:binding element.
+ * @param definitions a wsdl:definitions element.
+ * @param bindingName a name of wsdl:binding element.
+ * @return a wsdl:binding element or null if it is not found.
+ */
+ private Element getBindingElement(Element definitions, String bindingName)
+ {
+ // Getting the first definitions' child
+ Element child = XMLUtils.getFirstChild(definitions);
+ while (child != null)
+ {
+ // If definitions' child is wsdl:binding element
+ // and is the same that is being processed by WSDLValidator
+ if (child.getNamespaceURI().equals(WSDL_BINDING.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_BINDING.getLocalPart())
+ && child.getAttribute(WSIConstants.ATTR_NAME).equals(bindingName))
+ {
+ // return the wsdl:binding element
+ return child;
+ }
+ // Getting the next definitions' child
+ child = XMLUtils.getNextSibling(child);
+ }
+ // return null, is there is no such wsdl:binding
+ 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/wsdl/AP2909.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2909.java
new file mode 100644
index 000000000..86681ba50
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2909.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+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.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2909
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Multiple mime:content child elements of a mime:part element
+ * in a desciption reference the same wsdl:part.</assertionDescription>
+ */
+public class AP2909 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ // A variable that indicates a binding contains
+ // multiple mime:content elements
+ private boolean multipleContentFound;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2909(WSDLValidatorImpl 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
+ {
+ // Resetting the variable
+ multipleContentFound = false;
+
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:part elements from wsdl:input and wsdl:output
+ List inputMimeParts = getMimeParts(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeParts = getMimeParts(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If there is a mime:part containing multiple mime:contentS
+ // which reference different wsdl:partS, the assertion failed
+ if (containsInvalidMimePart(inputMimeParts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ // If there is a mime:part containing multiple mime:contentS
+ // which reference different wsdl:partS, the assertion failed
+ if (containsInvalidMimePart(outputMimeParts))
+ {
+ throw new AssertionFailException("The invalid mime:part element "
+ + "is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ }
+ // If the binding does not contain a mime:part with multiple
+ // mime:content elements, the assertion is not applicable
+ if (!multipleContentFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Validates mime:part elements.
+ * @param mimeParts a list of mime:part elements.
+ * @return true if multiple mime:contentS of a mime:part
+ * reference different wsdl:partS, false otherwise.
+ */
+ private boolean containsInvalidMimePart(List mimeParts)
+ {
+ // Going through a list of mime:part elements
+ for (int i = 0; i < mimeParts.size(); i++)
+ {
+ // A variable that indicates the mime:part contains
+ // at least one mime:content element
+ boolean mimeContentFound = false;
+ String mimeContentPart = null;
+
+ // Going through mime:part extensibility elements
+ List extElems = ((MIMEPart) mimeParts.get(i)).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ // If an extensibility element is mime:content
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ MIMEContent mimeContent = (MIMEContent) extElems.get(j);
+ // If a mime:content element was already found in this mime:part
+ if (mimeContentFound)
+ {
+ multipleContentFound = true;
+ // If a mime:content references other wsdl:part than the
+ // previous mime:content do, return true
+ if (mimeContent.getPart() == null
+ || !mimeContent.getPart().equals(mimeContentPart))
+ {
+ return true;
+ }
+ }
+ // This is the first mime:content element of mime:part
+ else
+ {
+ mimeContentFound = true;
+ mimeContentPart = mimeContent.getPart();
+ }
+ }
+ }
+ }
+ // There are no invalid mime:part elements, return false
+ return false;
+ }
+
+ /**
+ * Collects all mime:part elements.
+ * @param extElems a list of extensibility elements that can contain mime:part elements.
+ * @return the list of mime:part elements found.
+ */
+ private List getMimeParts(List extElems)
+ {
+ List mimeParts = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ mimeParts.addAll(mParts);
+ // Going through all the mime:part elements
+ for (int j = 0; j < mParts.size(); j++)
+ {
+ List elems = getMimeParts(
+ ((MIMEPart) mParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeParts.addAll(elems);
+ }
+ }
+ }
+ }
+ return mimeParts;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2910.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2910.java
new file mode 100644
index 000000000..a42d335d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2910.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2910
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A mime:content in a DESCRIPTION references
+ * a wsdl:part that is defined using either the type attribute
+ * or the element attribute.</assertionDescription>
+ */
+public class AP2910 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2910(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If there is no the corresponding wsdl:input in wsdl:portType
+ // or the wsdl:input does not specify a message attribute,
+ // the assertion failed
+ if (portTypeInput == null || portTypeInput.getMessage() == null)
+ throw new AssertionFailException(
+ "The corresponging operation in the wsdl:portType for the \""
+ + bindingOperation.getName() + "\" binding operation is invalid.");
+ // Getting a mime:content referencing an invalid wsdl:part
+ String part = getInvalidMimeContentPart(
+ inputMimeContents, portTypeInput.getMessage());
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the input of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If there is no the corresponding wsdl:output in wsdl:portType
+ // or the wsdl:output does not specify a message attribute,
+ // the assertion failed
+ if (portTypeOutput == null || portTypeOutput.getMessage() == null)
+ throw new AssertionFailException(
+ "The corresponging operation in the wsdl:portType for the \""
+ + bindingOperation.getName() + "\" binding operation is invalid.");
+ // Getting a mime:content referencing an invalid wsdl:part
+ String part = getInvalidMimeContentPart(
+ outputMimeContents, portTypeOutput.getMessage());
+ // If such part is found, the assertion failed
+ if (part != null)
+ throw new AssertionFailException("part=\"" + part +
+ "\", the output of the binding operation \""
+ + bindingOperation.getName() + "\"");
+ }
+ }
+
+ // If the binding does not contain mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Validates every mime:content element. If it references a wsdl:part that
+ * is defined using neither the type attribute nor the element attribute
+ * or using them together, it is invalid.
+ * @param mimeContents a list of mime:content elements.
+ * @param message the corresponding wsdl:message element for mime:contentS.
+ * @return a value of the part attribute of an invalid mime:content
+ * or null if all the mime:content elements are valid.
+ */
+ private String getInvalidMimeContentPart(List mimeContents, Message message) {
+ // Going throug all the mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // Getting a value of the part attribute from a mime:element
+ String partName = ((MIMEContent) mimeContents.get(i)).getPart();
+ // Getting the corresponging wsdl:part
+ Part part = message.getPart(partName);
+ // if it is defined and use neither the type attribute
+ // nor the element attribute or use them together, return part value
+ if (part != null
+ && ((part.getTypeName() == null && part.getElementName() == null)
+ || (part.getTypeName() != null && part.getElementName() != null)))
+ {
+ return partName;
+ }
+ }
+ // Return null if no one part is found
+ return null;
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2911.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2911.java
new file mode 100644
index 000000000..943383bea
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2911.java
@@ -0,0 +1,228 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+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.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2911
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The mime:multipartRelated elements in wsdl:input and wsdl:ouput elements
+ * of operations in a wsdl:binding, contain exactly one mime:part child element that contains
+ * a soapbind:body child element.</assertionDescription>
+ */
+public class AP2911 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2911(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:multipartRelated element
+ boolean multipartsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:multipartRelated elements from wsdl:input and wsdl:output
+ List inputMultiparts = getMimeMultipartElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMultiparts = getMimeMultipartElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:multipartRelated elements
+ if (!inputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is not exactly one mime:part element containing
+ // a soapbind:body child, the assertion failed
+ if (!containsOneSoapBody(inputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:multipartRelated element is in the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ // If the wsdl:output contains mime:multipartRelated elements
+ if (!outputMultiparts.isEmpty())
+ {
+ multipartsFound = true;
+
+ // If there is not exactly one mime:part element containing
+ // a soapbind:body child, the assertion failed
+ if (!containsOneSoapBody(outputMultiparts))
+ {
+ throw new AssertionFailException("The invalid "
+ + "mime:multipartRelated element is in the wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ }
+ // If the binding contains no one mime:multipartRelated element,
+ // the assertion is not applicable
+ if (!multipartsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Looks for mime:part elements containing a soap:body child
+ * for each of mime:multipartRelated element.
+ * @param multiparts a list of mime:multipartRelated elements.
+ * @return true if there is exactly one mime:part containing a soap:body
+ * child, false otherwise.
+ */
+ private boolean containsOneSoapBody(List multiparts)
+ {
+ // A variable indicates that a soap:body element is found
+ boolean soapBodyFound = false;
+
+ // Going through a list of mime:multipartRelated elements
+ for (int i = 0; i < multiparts.size(); i++)
+ {
+ // Getting a list of mime:part elements
+ List mimeParts =
+ ((MIMEMultipartRelated) multiparts.get(i)).getMIMEParts();
+
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Getting a list of extensibility elements of a mime:part
+ List extElems =
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements();
+ // Going through the extensibility elements
+ for (int k = 0; k < extElems.size(); k++)
+ {
+ // If an extensibility element is a soap:body
+ if (((ExtensibilityElement)extElems.get(k))
+ .getElementType().equals(WSDL_SOAP_BODY))
+ {
+ // If a soap:body element was already found,
+ // return true
+ if (soapBodyFound)
+ {
+ return false;
+ }
+ // else set the variable to the true value
+ else
+ {
+ soapBodyFound = true;
+ }
+ }
+ }
+ }
+ }
+
+ return soapBodyFound;
+ }
+
+ /**
+ * Collects all mime:multipartRelated elements.
+ * @param extElems a list of extensibility elements that can contain mime:multipartRelated elements.
+ * @return the list of mime:multipartRelated elements found.
+ */
+ private List getMimeMultipartElements(List extElems)
+ {
+ List mimeMultipartElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Adding the element to the list being returned
+ mimeMultipartElements.add(extElem);
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:multipartRelated elements of this mime:part
+ List elems = getMimeMultipartElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeMultipartElements.addAll(elems);
+ }
+ }
+ }
+ }
+
+ return mimeMultipartElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2930.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2930.java
new file mode 100644
index 000000000..01734f8ba
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2930.java
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+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.report.AssertionResult;
+
+/**
+ * AP2930
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A wsdl:fault element in a description does not have
+ * mime:multipartRelated element as its child element.</assertionDescription>
+ */
+public class AP2930 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2930(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // wsdl:fault element
+ boolean faultsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:fault elements
+ Collection faults = bindingOperation.getBindingFaults().values();
+ if (!faults.isEmpty())
+ {
+ faultsFound = true;
+ // If there is at least one mime:multipartRelated element,
+ // the assertion failed
+ if (containsMimeMultiparts(faults))
+ throw new AssertionFailException("The binding operation is \""
+ + bindingOperation.getName() + "\".");
+ }
+ }
+
+ // If the binding does not contain wsdl:fault elements,
+ // the assertion is not applicable
+ if (!faultsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Validates wsdl:fault elements.
+ * @param faults a collection of wsdl:fault elements.
+ * @return true if any wsdl:fault has a mime:multipartRelated child
+ * element, false otherwise.
+ */
+ private boolean containsMimeMultiparts(Collection faults)
+ {
+ // Going through all the wsdl:faultS
+ Iterator i = faults.iterator();
+ while (i.hasNext())
+ {
+ // Getting wsdl:fault's extensibility elements
+ List extElems = ((BindingFault) i.next()).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ // If there is a mime:multipartRelated element, return true
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ return true;
+ }
+ }
+ }
+ // There are no mime:multipartRelated elements, return false
+ 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/wsdl/AP2940.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2940.java
new file mode 100644
index 000000000..6392a1d40
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2940.java
@@ -0,0 +1,450 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+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.impl.dv.XSSimpleType;
+import org.apache.xerces.xs.XSAttributeUse;
+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.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.report.AssertionResult;
+import org.w3c.dom.Element;
+
+/**
+ * AP2940
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>In a description, a wsdl:part defined with the
+ * ref:swaRef schema type is bound to a soapbind:body, or a soapbind:header
+ * in a MIME binding.</assertionDescription>
+ */
+public class AP2940 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2940(WSDLValidatorImpl 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
+ {
+ // A variable that indicates wsdl:portType references at least one
+ // wsdl:part defined with the ref:swaRef schema type
+ boolean swaRefFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // Collecting all the message's parts defined with ref:swaRef
+ List swaRefParts = getSwaRefParts(portTypeInput.getMessage());
+ if (!swaRefParts.isEmpty())
+ {
+ swaRefFound = true;
+ // Getting a wsdl:part that is unbound
+ String unboundPart = getUnboundPart(swaRefParts,
+ portTypeInput.getMessage().getQName(),
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ // If such wsdl:part exists, assertion failed
+ if (unboundPart != null)
+ throw new AssertionFailException("The part \"" + unboundPart
+ + "\" is not bound properly to the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // Collecting all the message's parts defined with ref:swaRef
+ List swaRefParts = getSwaRefParts(portTypeOutput.getMessage());
+ if (!swaRefParts.isEmpty())
+ {
+ swaRefFound = true;
+ // Getting a wsdl:part that is unbound
+ String unboundPart = getUnboundPart(swaRefParts,
+ portTypeOutput.getMessage().getQName(),
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+ // If such wsdl:part exists, assertion failed
+ if (unboundPart != null)
+ throw new AssertionFailException("The part \"" + unboundPart
+ + "\" is not bound properly to the wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation.");
+ }
+ }
+ }
+
+ // If there is no wsdl:partS defined with the ref:swaRef
+ // schema type, the assertion is not applicable
+ if (!swaRefFound)
+ throw new AssertionNotApplicableException();
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException afe)
+ {
+ // The assertion is "recommended", using the "warning" result
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Looks for a wsdl:part that is not bound to either soap:body or soap:header
+ * in a MIME binding.
+ * @param swaRefParts a list of wsdl:part names that are defined with the
+ * ref:swaRef schema type.
+ * @param messageName the qualified name of the wsdl:message being validated.
+ * @param extElems a list of extensibility elements of either wsdl:input or
+ * wsdl:output of the corresponding binding operation.
+ * @return a wsdl:part name that is not bound properly, or null.
+ */
+ private String getUnboundPart(List swaRefParts, QName messageName, List extElems) {
+ // Going through wsdl:part names
+ for (int i = 0; i < swaRefParts.size(); i++)
+ {
+ String part = (String) swaRefParts.get(i);
+ boolean boundProperly = false;
+ if (extElems != null)
+ {
+ // Going through extensibility elements
+ for (int j = 0; j < extElems.size() && !boundProperly; j++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(j);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Getting the first mime:part element where soap:body
+ // and soap:header could appear
+ if (mimeParts.size() > 0)
+ {
+ List elems = ((MIMEPart) mimeParts.get(0)).getExtensibilityElements();
+ // 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))
+ {
+ List pts = ((SOAPBody) elem).getParts();
+ // If the part is bound by this element
+ if (pts == null || pts.contains(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ // else if that is a soap:header
+ else if (elem.getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ if (elem instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader) elem;
+ // If the part is bound by this element
+ if (messageName.equals(header.getMessage())
+ && header.getPart() != null
+ && header.getPart().equals(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ // 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();
+ // If a header references the corresponding message
+ // and the part is bound by this element
+ if (referencesMessage(header, messageName)
+ && header.getAttribute("part").equals(part))
+ {
+ boundProperly = true;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ // If this part is unbound properly, return it
+ if (!boundProperly)
+ return part;
+ }
+ // All the parts are bound properly, return null
+ return null;
+ }
+
+ /**
+ * Validates whether an element contains a message attribute that references
+ * a message that have the qualified name specified.
+ * @param elem an element to be validated.
+ * @param messageName the qualified name of a message.
+ * @return true if an element is valid, false otherwise.
+ */
+ private boolean referencesMessage(Element elem, QName messageName)
+ {
+ // Getting the element's message attribute
+ String message = elem.getAttribute("message");
+ // finding the colon delimiter
+ int colonPos = message.indexOf(":");
+ String ns = null;
+ // Getting a local part
+ String lp = colonPos > -1 ? message.substring(colonPos + 1) : message;
+ // If the delimiter is found
+ if (colonPos > -1)
+ {
+ // Retrieving a namespace URI
+ ns = validator.wsdlDocument.getDefinitions()
+ .getNamespace(message.substring(0, colonPos));
+ }
+ // If the local part and the namespace URI are the same as a message have
+ if (messageName.getLocalPart().equals(lp)
+ && messageName.getNamespaceURI().equals(ns))
+ {
+ // element is valid, return true
+ return true;
+ }
+ // element is not valid, return false
+ return false;
+ }
+
+ /**
+ * Collects all the wsdl:part defined with the ref:swaRef schema type.
+ * @param message a message containig wsdl:part elements.
+ * @return a list of wsdl:part names.
+ */
+ private List getSwaRefParts(Message message)
+ {
+ List swaRefParts = new ArrayList();
+
+ // Going through message's parts
+ Iterator it = message.getParts().values().iterator();
+ while (it.hasNext())
+ {
+ Part part = (Part) it.next();
+ 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 does conatins neither element nor type attribute,
+ // proceeding with the next part
+ else
+ {
+ continue;
+ }
+ // Getting a list of schemas defined
+ Map schemas = validator.wsdlDocument.getSchemas();
+ // Going through the schemas
+ Iterator it2 = schemas.values().iterator();
+ while (it2.hasNext())
+ {
+ XSModel xsModel = (XSModel) it2.next();
+ XSTypeDefinition partType = null;
+ // Getting the corresponding part type
+ if (type == XSConstants.ELEMENT_DECLARATION)
+ {
+ XSElementDeclaration elem = xsModel.getElementDeclaration(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ if (elem != null)
+ partType = elem.getTypeDefinition();
+ }
+ else
+ {
+ partType = xsModel.getTypeDefinition(
+ ref.getLocalPart(), ref.getNamespaceURI());
+ }
+ // If the part type is defined using the ref:swaRef schema type
+ if (referencesSwaRef(partType, new ArrayList()))
+ {
+ // Adding the part's name to the list being returned
+ swaRefParts.add(part.getName());
+ }
+ }
+ }
+ // Return the list
+ return swaRefParts;
+ }
+
+ /**
+ * Check schema type whether it contains ref:swaRef simple schema type
+ * or has an attribute of this schema type.
+ * @param xsType a schema type definition element
+ * @return true, if schema type contains ref:swaRef, false otherwise.
+ */
+ private boolean referencesSwaRef(XSTypeDefinition xsType, List types)
+ {
+ if ((xsType != null) && (!types.contains(xsType)))
+ {
+ types.add(xsType);
+ // If this is a complex type
+ if (xsType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
+ {
+ XSComplexTypeDefinition xsComplexType =
+ (XSComplexTypeDefinition) xsType;
+ // If it contains mixed context
+ // check whether the context contains ref:swaRef
+ if (xsComplexType.getParticle() != null
+ && referencesSwaRef(xsComplexType.getParticle().getTerm(), types))
+ {
+ return true;
+ }
+ // Getting the type's attributes
+ XSObjectList attrList = xsComplexType.getAttributeUses();
+ for (int i = 0; i < attrList.getLength(); i++)
+ {
+ XSAttributeUse xsAttrUse = (XSAttributeUse) attrList.item(i);
+ // If an attribute is defined using ref:swaRef, return true
+ if (referencesSwaRef(
+ xsAttrUse.getAttrDeclaration().getTypeDefinition(), types))
+ {
+ return true;
+ }
+ }
+ }
+ // else if this is a simple type
+ else if (xsType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE)
+ {
+ XSSimpleType xsSimpleType = (XSSimpleType) xsType;
+ // If this type is ref:swaRef, return true
+ if (xsSimpleType.getNamespace().equals(WSIConstants.NS_URI_SWA_REF)
+ && xsSimpleType.getName().equals(WSIConstants.SCHEMA_TYPE_SWA_REF))
+ {
+ return true;
+ }
+ }
+ }
+ // The schema type does not contain any element defined with the ref:swaRef
+ // return false
+ return false;
+ }
+
+ /**
+ * Checks a term whether it is defined with ref:swaRef.
+ * @param term a term that can be one of a model group or an
+ * element declaration.
+ * @return true if a term is defined with ref:swaRef, false otherwise.
+ */
+ private boolean referencesSwaRef(XSTerm term, List types)
+ {
+ // If a term is an element declaration
+ if (term.getType() == XSConstants.ELEMENT_DECLARATION)
+ {
+ // If element's type is defined with the ref:swaRef, return true
+ if (referencesSwaRef(
+ ((XSElementDeclaration) term).getTypeDefinition(), types))
+ {
+ return true;
+ }
+ }
+ // 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++)
+ {
+ // If the term of a particle is defined with the ref:swaRef,
+ // return true
+ if (referencesSwaRef(((XSParticle) list.item(i)).getTerm(), types))
+ {
+ 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/wsdl/AP2941.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2941.java
new file mode 100644
index 000000000..bb3a7a3ab
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2941.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.xml.namespace.QName;
+
+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.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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
+import org.w3c.dom.Element;
+
+/**
+ * AP2941
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>A wsdl:binding in a description binds every wsdl:part
+ * of a wsdl:message in the wsdl:portType to which it refers to one of
+ * soapbind:body, soapbind:header, soapbind:fault , soapbind:headerfault,
+ * or mime:content.</assertionDescription>
+ */
+public class AP2941 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2941(WSDLValidatorImpl 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
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // Getting the list of all the parts bound by wsdl:input's child elements
+ List inputParts = getBindingParts(
+ bindingOperation.getBindingInput().getExtensibilityElements(),
+ portTypeInput.getMessage());
+ // If not true that all the wsdl:partS are bound,
+ // the assertion failed
+ if (!inputParts
+ .containsAll(portTypeInput.getMessage().getParts().keySet()))
+ {
+ throw new AssertionFailException("The wsdl:input of the \""
+ + bindingOperation.getName() + "\" binding operation does not "
+ + "bind all the corresponding wsdl:partS.");
+ }
+ }
+
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // Getting the list of all the parts bound by wsdl:output's child elements
+ List outputParts = getBindingParts(
+ bindingOperation.getBindingOutput().getExtensibilityElements(),
+ portTypeOutput.getMessage());
+ // If not true that all the wsdl:partS are bound,
+ // the assertion failed
+ if (!outputParts
+ .containsAll(portTypeOutput.getMessage().getParts().keySet()))
+ {
+ throw new AssertionFailException("The wsdl:output of the \""
+ + bindingOperation.getName() + "\" binding operation does not "
+ + "bind all the corresponding wsdl:partS.");
+ }
+ }
+
+ // IF there are wsdl:faultS in the wsdl:portType operation
+ if (!bindingOperation.getOperation().getFaults().isEmpty())
+ {
+ // Collecting all the soap:fault names
+ List faultNames = new ArrayList();
+ Collection faults = bindingOperation.getBindingFaults().values();
+ // Going through all the wsdl:faultS
+ Iterator it = faults.iterator();
+ while (it.hasNext())
+ {
+ // Getting wsdl:fault's extensibility elements
+ List extElems = ((BindingFault) it.next()).getExtensibilityElements();
+ for (int j = 0; j < extElems.size(); j++)
+ {
+ if (((ExtensibilityElement)extElems.get(j))
+ .getElementType().equals(WSDL_SOAP_FAULT))
+ {
+ faultNames.add(((SOAPFault)extElems.get(j)).getName());
+ }
+ }
+ }
+ // If not true that all the wsdl:faultS are bound,
+ // the assertion failed
+ if (!faultNames.containsAll(
+ bindingOperation.getOperation().getFaults().keySet()))
+ {
+ throw new AssertionFailException("The binding operation \""
+ + bindingOperation.getName() + "\" does not "
+ + "bind all the corresponding wsdl:faultS.");
+ }
+ }
+ }
+ }
+ catch (AssertionFailException afe)
+ {
+ // The assertion is "recommended", using the "warning" result
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail(
+ afe.getMessage(), entryContext);
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Collects all the parts bound by extensibility elements.
+ * @param extElems a lit of extensibility elements.
+ * @param message the wsdl:message element corresponging
+ * to the extensibility elements.
+ * @return a list of wsdl:part names bound.
+ */
+ private List getBindingParts(List extElems, Message message)
+ {
+ List parts = new ArrayList();
+ if (extElems != null)
+ {
+ // Going through the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If that is a soap:body
+ if (extElem.getElementType().equals(WSDL_SOAP_BODY))
+ {
+ // Adding all the parts bound to the list
+ List pts = ((SOAPBody) extElem).getParts();
+ if (pts != null)
+ {
+ parts.addAll(pts);
+ }
+ // else the parts attribute is omitted,
+ // all parts defined by the message are assumed to be included
+ // in the SOAP Body portion.
+ else
+ {
+ parts.addAll(message.getParts().keySet());
+ }
+ }
+ // else if that is a soap:header
+ else if (extElem.getElementType().equals(WSDL_SOAP_HEADER))
+ {
+ List headerFaults = null;
+ if (extElem instanceof SOAPHeader)
+ {
+ SOAPHeader header = (SOAPHeader) extElem;
+ // If a header references the corresponding message,
+ // adding part name to the list
+ if (message.getQName().equals(header.getMessage()))
+ parts.add(header.getPart());
+
+ headerFaults = header.getSOAPHeaderFaults();
+ }
+ // WSDL4J 1.4 does not recognize soap:header elements that are enclosed
+ // in mime:multipartRelated, so using a workaround
+ else
+ {
+ Element header =
+ ((UnknownExtensibilityElement) extElem).getElement();
+ // If a header references the corresponding message,
+ // adding part name to the list
+ if (referencesMessage(header, message.getQName()))
+ parts.add(header.getAttribute("part"));
+ // Collecting soap:headerfault elements for the header
+ headerFaults = getHeaderFaults(header);
+ }
+ // Going through the soap:headerfaultS
+ for (int j = 0; j < headerFaults.size(); j++)
+ {
+ if (headerFaults.get(j) instanceof SOAPHeaderFault)
+ {
+ SOAPHeaderFault shf = (SOAPHeaderFault) headerFaults.get(j);
+ // If a soap:headerfault references the corresponding
+ // message, adding part name to the list
+ if (message.equals(shf.getMessage()))
+ parts.add(shf.getPart());
+ }
+ // the same workaround...
+ else
+ {
+ Element shf = (Element) headerFaults.get(j);
+ // If a soap:headerfault references the corresponding
+ // message, adding part name to the list
+ if (referencesMessage(shf, message.getQName()))
+ parts.add(shf.getAttribute("part"));
+ }
+ }
+ }
+ // else if that is a mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // adding part name to the list
+ parts.add(((MIMEContent) extElem).getPart());
+ }
+ // else if that is a mime:multipartRelated
+ else if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the values of part attributes
+ // of mime:part's extensibility elements
+ parts.addAll(getBindingParts(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements(),
+ message));
+ }
+ }
+ }
+ }
+ return parts;
+ }
+
+ /**
+ * Validates whether an element contains a message attribute that references
+ * a message that have the qualified name specified.
+ * @param elem an element to be validated.
+ * @param messageName the qualified name of a message.
+ * @return true if an element is valid, false otherwise.
+ */
+ private boolean referencesMessage(Element elem, QName messageName)
+ {
+ // Getting the element's message attribute
+ String message = elem.getAttribute("message");
+ // finding the colon delimiter
+ int colonPos = message.indexOf(":");
+ String ns = null;
+ // Getting a local part
+ String lp = colonPos > -1 ? message.substring(colonPos + 1) : message;
+ // If the delimiter is found
+ if (colonPos > -1)
+ {
+ // Retrieving a namespace URI
+ ns = validator.wsdlDocument.getDefinitions()
+ .getNamespace(message.substring(0, colonPos));
+ }
+ // If the local part and the namespace URI are the same as a message have
+ if (messageName.getLocalPart().equals(lp)
+ && messageName.getNamespaceURI().equals(ns))
+ {
+ // element is valid, return true
+ return true;
+ }
+ // element is not valid, return false
+ return false;
+ }
+
+ /**
+ * Collects all the element's child elements of the soap:headerfault type.
+ * @param element an element that can have soap:headerfault elements.
+ * @return the list of soap:headerfault elements found.
+ */
+ private List getHeaderFaults(Element element)
+ {
+ List headerFaults = new ArrayList();
+ if (element != null)
+ {
+ // Getting the first header's child
+ Element child = XMLUtils.getFirstChild(element);
+ while (child != null)
+ {
+ // If the child is soap:headerfault
+ if (child.getNamespaceURI().equals(WSDL_SOAP_HEADERFAULT.getNamespaceURI())
+ && child.getLocalName().equals(WSDL_SOAP_HEADERFAULT.getLocalPart()))
+ {
+ // Adding the child to the list
+ headerFaults.add(child);
+ }
+ // Getting the next header's child
+ child = XMLUtils.getNextSibling(child);
+ }
+ }
+ return headerFaults;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2944.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2944.java
new file mode 100644
index 000000000..ca93a7bfd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2944.java
@@ -0,0 +1,234 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.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.report.AssertionResult;
+
+/**
+ * AP2944
+ *
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>In a DESCRIPTION, if a wsdl:part element refers to a
+ * global element declaration (via the element attribute of the wsdl:part element)
+ * then the value of the type attribute of a mime:content element that binds that part
+ * is a content type suitable for carrying an XML serialization.</assertionDescription>
+ */
+public class AP2944 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ // A variable that indicates a binding contains mime:content elements
+ // that bind wsdl:partS defined with the element attribute
+ private boolean mimeContentFound;
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2944(WSDLValidatorImpl 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
+ {
+ // Resetting the variable
+ mimeContentFound = false;
+
+ try
+ {
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ Input portTypeInput = bindingOperation.getOperation().getInput();
+ // If the corresponding wsdl:input exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeInput != null && portTypeInput.getMessage() != null)
+ {
+ // If there is an invalid mime:content element
+ MIMEContent imc = getInvalidMimeContent(
+ inputMimeContents, portTypeInput.getMessage());
+ if (imc != null)
+ {
+ throw new AssertionFailException("The mime:content element in "
+ + "the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" that binds the \"" + imc.getPart()
+ + "\" wsdl:part uses the invalid content type \""
+ + imc.getType() + "\". ");
+ }
+ }
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ Output portTypeOutput = bindingOperation.getOperation().getOutput();
+ // If the corresponding wsdl:output exists in wsdl:portType
+ // and includes the message attribute
+ if (portTypeOutput != null && portTypeOutput.getMessage() != null)
+ {
+ // If there is an invalid mime:content element
+ MIMEContent imc = getInvalidMimeContent(
+ outputMimeContents, portTypeOutput.getMessage());
+ if (imc != null)
+ {
+ throw new AssertionFailException("The mime:content element in "
+ + "the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" that binds the \"" + imc.getPart()
+ + "\" wsdl:part uses the invalid content type \""
+ + imc.getType() + "\". ");
+ }
+ }
+ }
+ }
+ // If mime:content elements are not found,
+ // the assertion is not applicable
+ if (!mimeContentFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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);
+ }
+
+ /**
+ * Checks whether any mime:content element binds wsdl:part that is defined
+ * with the element attribute and uses the content type "text/xml".
+ * @param mimeContents a list of mime:content elements of binding operation.
+ * @param message the corresponding wsdl:message element.
+ * @return a mime:content element that uses a content type other than
+ * "text/xml", null if no one such element is found.
+ */
+ private MIMEContent getInvalidMimeContent(List mimeContents, Message message)
+ {
+ // Going through a list of mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ MIMEContent mimeContent = (MIMEContent) mimeContents.get(i);
+ // Getting the corresponding wsdl:part
+ Part part = message.getPart(mimeContent.getPart());
+ // If the part is defined with the element attribute
+ if (part != null && part.getElementName() != null)
+ {
+ mimeContentFound = true;
+ // If the type attribute value is other than "text/xml"
+ if (!WSIConstants.CONTENT_TYPE_TEXT_XML.equals(mimeContent.getType()))
+ {
+ // return the invalid element
+ return mimeContent;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Collects all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2946.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2946.java
new file mode 100644
index 000000000..4555739d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/AP2946.java
@@ -0,0 +1,194 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.ArrayList;
+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.mime.MIMEContent;
+import javax.wsdl.extensions.mime.MIMEMultipartRelated;
+import javax.wsdl.extensions.mime.MIMEPart;
+
+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.report.AssertionResult;
+
+/**
+ * AP2946
+ *
+ * <context>For a candidate wsdl:binding with at least one mime:content element</context>
+ * <assertionDescription>In a DESCRIPTION, a mime:content element
+ * includes the part attribute.</assertionDescription>
+ */
+public class AP2946 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public AP2946(WSDLValidatorImpl 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
+ {
+ // A variable that indicates a binding contains at least one
+ // mime:content element
+ boolean mimeContentsFound = false;
+
+ // Getting a wsdl:binding
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Getting its wsdl:operation elements
+ List ops = binding.getBindingOperations();
+
+ // Going through the operation elements
+ for (int i = 0; i < ops.size(); i++)
+ {
+ BindingOperation bindingOperation = (BindingOperation) ops.get(i);
+
+ // Getting wsdl:input and wsdl:output elements of an operation
+ BindingInput bindingInput = bindingOperation.getBindingInput();
+ BindingOutput bindingOutput = bindingOperation.getBindingOutput();
+
+ // Collecting all the mime:content elements from wsdl:input and wsdl:output
+ List inputMimeContents = getMimeContentElements(
+ bindingInput == null ? null : bindingInput.getExtensibilityElements());
+ List outputMimeContents = getMimeContentElements(
+ bindingOutput == null ? null : bindingOutput.getExtensibilityElements());
+
+ // If the wsdl:input contains mime:content elements
+ if (!inputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ // If there is a mime:content that does not include
+ // the part attribute, the assertion failed
+ if (hasInvalidMimeContent(inputMimeContents))
+ throw new AssertionFailException("The invalid mime:content element"
+ + " is in the wsdl:input of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+
+ // If the wsdl:output contains mime:content elements
+ if (!outputMimeContents.isEmpty())
+ {
+ mimeContentsFound = true;
+ // If there is a mime:content that does not include
+ // the part attribute, the assertion failed
+ if (hasInvalidMimeContent(outputMimeContents))
+ throw new AssertionFailException("The invalid mime:content element"
+ + " is in the wsdl:output of the \"" + bindingOperation.getName()
+ + "\" binding operation.");
+ }
+ }
+
+ // If the binding contains no mime:content elements,
+ // the assertion is not applicable
+ if (!mimeContentsFound)
+ throw new AssertionNotApplicableException();
+ }
+ 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 all mime:content elements.
+ * @param extElems a list of extensibility elements that can contain mime:contentS.
+ * @return the list of mime:content elements found.
+ */
+ private List getMimeContentElements(List extElems)
+ {
+ List mimeContentElements = new ArrayList();
+
+ if (extElems != null)
+ {
+ // Going through all the extensibility elements
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(i);
+ // If the element is mime:multipartRelated
+ if (extElem.getElementType().equals(WSDL_MIME_MULTIPART))
+ {
+ // Getting the mime:part elements of the mime:multipartRelated
+ List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts();
+ // Going through all the mime:part elements
+ for (int j = 0; j < mimeParts.size(); j++)
+ {
+ // Collecting all the mime:content elements of this mime:part
+ List elems = getMimeContentElements(
+ ((MIMEPart) mimeParts.get(j)).getExtensibilityElements());
+ // Adding the elements to the list being returned
+ mimeContentElements.addAll(elems);
+ }
+ }
+ // Else if the element is mime:content
+ else if (extElem.getElementType().equals(WSDL_MIME_CONTENT))
+ {
+ // Adding the element to the list being returned
+ mimeContentElements.add(extElem);
+ }
+ }
+ }
+
+ return mimeContentElements;
+ }
+
+ /**
+ * Validates mime:content elements.
+ * @param mimeContents a list of mime:content elements.
+ * @return true if any mime:content does not include the part attribute,
+ * false otherwise
+ */
+ private boolean hasInvalidMimeContent(List mimeContents)
+ {
+ // Going through a list of mime:content elements
+ for (int i = 0; i < mimeContents.size(); i++)
+ {
+ // If a mime:content does not include the part attribute, return true
+ if (((MIMEContent) mimeContents.get(i)).getPart() == null)
+ return true;
+ }
+ // There are no invalid mime:contentS, return false
+ 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/wsdl/BP2010.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2010.java
new file mode 100644
index 000000000..e15193eb6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2010.java
@@ -0,0 +1,119 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Operation;
+import javax.wsdl.PortType;
+
+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.report.AssertionResult;
+
+
+/**
+* BP2010.
+* "Name" attributes of Operations are unique across the wsdl:portType definition
+*
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2010 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2010(WSDLValidatorImpl 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
+ {
+
+ // Get the portType from the entry context
+ PortType portType = (PortType) entryContext.getEntry().getEntryDetail();
+
+ // Check the operations names for uniqueness within the candidate Port Type in the WSDL
+ Iterator ops;
+ HashSet namesSeen = new HashSet();
+ HashSet duplicates = new HashSet();
+ try
+ {
+ List opsList = portType.getOperations();
+ if (opsList == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ // no operations found in portType
+ }
+ else
+ {
+ ops = opsList.iterator(); // will use Candidate.getOperations()
+ while (ops.hasNext())
+ {
+ Operation op = (Operation) ops.next();
+ String opName = op.getName();
+ if (namesSeen.contains(opName))
+ {
+ duplicates.add(opName);
+ }
+ else
+ {
+ namesSeen.add(opName);
+ }
+ }
+ }
+
+ if (!duplicates.isEmpty())
+ {
+ StringBuffer failInfo =
+ new StringBuffer(
+ "Duplicate operation names in portType "
+ + portType.getQName()
+ + ": ");
+ Iterator i = duplicates.iterator();
+ while (i.hasNext())
+ {
+ failInfo.append((String) i.next() + "; ");
+ }
+ throw new AssertionFailException(failInfo.toString());
+ }
+ }
+ catch (NullPointerException e)
+ { // ?? no operations found, but does not fail the assertion.
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, portType);
+ }
+
+ // 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/wsdl/BP2011.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2011.java
new file mode 100644
index 000000000..2d5fd1847
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2011.java
@@ -0,0 +1,341 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.StringTokenizer;
+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;
+
+
+/**
+ * BP2011.
+ * The imported XML schema is a well-formed XML 1.0 document and if it contains an
+ * XML declaration, it is version 1.0.
+ *
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+**/
+public class BP2011 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2011(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS =
+ new char[] { 0x20, 0x9, 0xD, 0xA, '\'', '\"' };
+ private final char[] XML_DECLARATION_DELIMITERS = new char[] { '=' };
+ private final String VERSION_TOKEN = "version";
+ private final String VERSION = "1.0";
+
+ /* 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
+ {
+ result = result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ //Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+
+ List exts = null;
+ //if (def.getTypes()!=null)
+ if (types != null)
+ {
+ exts = types.getExtensibilityElements();
+ }
+ if (exts != null)
+ {
+ Definition definition = null;
+ if ((definition =
+ validator.analyzerContext.getCandidateInfo().getDefinition(types))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement)
+ searchForSchema(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+ }
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ } /*else
+ result = AssertionResult.RESULT_PASSED;*/
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /* Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param n - UnknownExtencibilityElement
+ */
+ private void searchForSchema(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ processSchema(n, context);
+ else
+ // if xsd:import element is found -> load schema and process schema
+ // FIXED: if xsd:import is found and parent element is xsd:schema
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT)
+ && XMLUtils.equals(n.getParentNode(), ELEM_XSD_SCHEMA))
+ loadSchema(n, context);
+ else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild(), context);
+ }
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * It loads xsd schema and then check the version 1.0 and looking for xsd:schema element for next process.
+ * @param importNode xsd schema
+ */
+ private void loadSchema(Node importNode, String context)
+ {
+ Element im = (Element) importNode;
+ Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ {
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ String decl =
+ readXMLDeclarationStatement(schemaLocation.getValue(), context);
+ if (!validVersion(decl))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ errors.add((a != null) ? a.getValue() : "");
+ }
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+ if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ processSchema(schema.getDocumentElement(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+ result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+ // else if there is only the namespace attribute, the import relates to inline schema
+ else if (XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE) != null)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+
+ /**
+ * Reads an XML declaration statement.
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location, String baseURI)
+ {
+ String result = null;
+ try
+ {
+ new URL(location);
+ }
+ catch (Throwable t)
+ {
+ // nothing
+ int i = baseURI.lastIndexOf('/');
+ int j = baseURI.lastIndexOf('\\');
+ if (j > i)
+ i = j;
+ location = baseURI.substring(0, i + 1) + location;
+ }
+
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ }
+ else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+
+ StringBuffer buf = new StringBuffer();
+ if (charCode == '<')
+ {
+ buf.append((char) charCode);
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+
+ end = charCode == '>';
+ }
+ }
+ else
+ {
+ // NOTE: This result does not get propogated back!
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Cannot read the XML declaration statement.";
+ }
+
+ result = buf.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains version="1.0" it retirns true.
+ */
+ private boolean validVersion(String xmlDecl)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st =
+ new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS,
+ XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+
+ if (token.equalsIgnoreCase(VERSION_TOKEN))
+ {
+ found = true;
+
+ tokens.nextElement();
+ String ver = (String) tokens.nextElement();
+
+ result = VERSION.equals(ver);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * It's loking for xsd import and load it if find.
+ * @param schema xsd schema
+ */
+ private void processSchema(Node schema, String context)
+ {
+ Node n = schema.getFirstChild();
+ while (n != null)
+ {
+ if (Node.ELEMENT_NODE == n.getNodeType()
+ && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ loadSchema(n, context);
+
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2012.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2012.java
new file mode 100644
index 000000000..fa33c1be8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2012.java
@@ -0,0 +1,123 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+
+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.wsdl.WSDLValidatorImpl.BindingMatch;
+import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
+
+
+/**
+ * BP2012.
+ * Example:
+ *
+ * <message name="getConfigurationOptionsRequest">
+ * <part name="refresh" element="cfg:refresh" />
+ * </message>
+ * <portType name="ConfiguratorPortType">
+ * <operation name="getConfigurationOptions">
+ * <input message="tns:getConfigurationOptionsRequest" />
+ * <output ..... />
+ * <fault ..... />
+ * </operation>
+ * </portType>
+ * <binding name="ConfiguratorBinding" type="tns:ConfiguratorPortType">
+ * <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
+ * <operation name="getConfigurationOptions">
+ * <soap:operation soapAction="http://www.zzz.com/zzz.wsdl/getConfigurationOptions" />
+ * <input>
+ * <soap:body use="literal" namespace="http://www.zzz.com/zzz.wsdl" />
+ * </input>
+ * <output>.....</output>
+ * <fault>......</fault>
+ * </operation>
+ * </binding>
+ *
+ * Above, the test for this assertion might be that the element attribute is specified in the "refresh"
+ * part of the getConfigurationOptionsRequest message.
+ *
+ * Context : for <binding> "ConfiguratorBinding", <soap:binding> style=document; <soap:body> use=literal
+ * for the <input> of binding operation "getConfigurationOptions".
+ * (<input> is an example. Could be <output> or <fault> equally).
+ * Action: check the part(s) of the message specified in the <input> element (in example) of the <portType>,
+ * namely tns:getConfigurationOptionsRequest, that the element attribute is specified. In this case we have
+ * <part name="refresh" element="cfg:refresh" />, so the test passes.
+ * All such parts associated with the assertion candidate binding(s) must be similarly checked for this assertion
+ * to pass.
+ */
+public class BP2012 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2012(WSDLValidatorImpl 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
+ {
+ // Get binding from entry context
+
+ // Oleg's & Graham's version:
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // to use original version require a binding array
+ //Binding[] binding = {(Binding) entryContext.getEntry().getEntryDetail()};
+
+ // get list of candidate matches
+ BindingMatch[] bindingMatch =
+ this.validator.getBindingMatches(
+ binding,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ if (bindingMatch.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ try
+ {
+ if (!this.validator.checkPartAttributes(bindingMatch, "useInput", "useElement")
+ || !this.validator.checkPartAttributes(bindingMatch, "useOutput", "useElement"))
+ {
+ // this should never happen
+ throw new AssertionFailException("diagnostic: internal processing error!");
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, binding);
+ }
+
+ // 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/wsdl/BP2013.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2013.java
new file mode 100644
index 000000000..b93a378db
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2013.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+
+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.wsdl.WSDLValidatorImpl.BindingMatch;
+import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
+
+
+/**
+ * BP2013.
+ * The binding (in soapbind:body elements) only refers to part elements that have been defined using the "type" attribute.
+ *
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+ */
+public class BP2013 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2013(WSDLValidatorImpl 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
+ {
+ // Get binding from entry context
+
+ // Oleg's & Graham's version:
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // to use original version require a binding array
+ //Binding[] binding = {(Binding) entryContext.getEntry().getEntryDetail()};
+
+ // get list of candidate matches
+ BindingMatch[] bindingMatch =
+ this.validator.getBindingMatches(
+ binding,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC,
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ if (bindingMatch.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ try
+ {
+ if (!this.validator.checkPartAttributes(bindingMatch, "useInput", "useType")
+ || !this.validator.checkPartAttributes(bindingMatch, "useOutput", "useType"))
+ {
+ // this should never happen
+ throw new AssertionFailException("diagnostic: internal processing error!");
+ }
+ }
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(e.getMessage(), entryContext, binding);
+ }
+
+ // 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/wsdl/BP2014.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2014.java
new file mode 100644
index 000000000..e31088981
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2014.java
@@ -0,0 +1,286 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2014.
+ * Context:
+ * For a candidate wsdl:operation, if referred to by a candidate rpc-literal wsdl:binding element
+ * If the parameterOrder attribute is present, it omits at most 1 part from output wsdl:message.
+ **/
+public class BP2014 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2014(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * @param binding - binding
+ * @return It returns style of soap binding of binding. If style omitted returns "document" style.
+ */
+ private String getSOAPBindingStyle(Binding binding)
+ {
+ String style = null;
+ List list = binding.getExtensibilityElements();
+ for (int i = 0; i < list.size(); i++)
+ {
+ if (list.get(i) instanceof SOAPBinding)
+ {
+ style = ((SOAPBinding) list.get(i)).getStyle();
+ break;
+ }
+ }
+ if (style == null)
+ style = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ return style;
+ }
+
+ /*
+ * @param list - List of extencibility elements from binding output
+ * @return first soap body in list.
+ */
+ private SOAPBody getSOAPBody(List list)
+ {
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i) instanceof SOAPBody)
+ return (SOAPBody) list.get(i);
+ return null;
+ }
+
+ /*
+ * @param list - List of extencibility elements of binding operation
+ * @return First soap operation in list.
+ */
+ private SOAPOperation getSOAPOperation(List list)
+ {
+ for (int i = 0; i < list.size(); i++)
+ if (list.get(i) instanceof SOAPOperation)
+ return (SOAPOperation) list.get(i);
+ return null;
+ }
+
+ /*
+ * @param oper - operation
+ * @param binding - binding
+ * @return if style of soap binding of binding is rpc and use of soap body of binding output of binding operation is literal then it returns true.
+ */
+ private boolean checkRpcLiteral(BindingOperation oper, Binding binding)
+ {
+ List list = oper.getExtensibilityElements();
+ SOAPOperation sop = getSOAPOperation(list);
+ if (sop == null)
+ return false;
+ String style =
+ (sop.getStyle() == null
+ ? getSOAPBindingStyle(binding)
+ : sop.getStyle());
+ if (!style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ return false;
+ list = oper.getBindingOutput().getExtensibilityElements();
+ SOAPBody body = getSOAPBody(list);
+ if (body == null)
+ return false;
+ String use = body.getUse();
+ if (use == null)
+ return false;
+
+ return use.equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT);
+ }
+
+ /* It checks operation contains more than one part in parameter order
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Operation obj, Object parent, WSDLTraversalContext ctx)
+ {
+ Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings();
+ if (obj.getParameterOrdering() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (bindings == null || obj == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (obj.getOutput() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ if (obj.getOutput().getMessage() == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+
+ // For each binding
+ for (int i = 0; i < bindings.length; i++)
+ {
+ List list = bindings[i].getBindingOperations();
+ // For each binding operation
+ for (int j = 0; j < list.size(); j++)
+ {
+ BindingOperation oper = (BindingOperation) list.get(j);
+
+ // If the input operation name and binding operatino name are not null
+ if (obj.getName() != null && oper.getName() != null)
+ {
+ // If the operation names are equal
+ if (obj.getName().equals(oper.getName()))
+ {
+ // If the operation is RPC literal
+ if (checkRpcLiteral(oper, bindings[i]))
+ {
+ // Get the list of parts in the parameterOrder attribute
+ List parts = obj.getParameterOrdering();
+
+ Output output = null;
+ Message message = null;
+ Map messageParts = null;
+
+ // Get the list of parts for the output message
+ if ((output = obj.getOutput()) != null)
+ {
+ if ((message = output.getMessage()) != null)
+ {
+ messageParts = message.getParts();
+ }
+ }
+
+ // If there are parts in the parameterOrder attribute
+ // and there are output message parts, then process assertion
+ if (parts != null && messageParts != null)
+ {
+ int partCount = 0;
+
+ String partName;
+ Iterator iterator = parts.iterator();
+ while (iterator.hasNext())
+ {
+ // Get part name from parameterOrder list
+ partName = (String) iterator.next();
+
+ // Check each output message part to see if there is a match
+ if (messageParts.containsKey(partName))
+ partCount++;
+ }
+
+ if ((partCount == messageParts.size())
+ || (partCount == messageParts.size() - 1))
+ result = AssertionResult.RESULT_PASSED;
+ else
+ {
+ errors.add(obj.getName());
+ ctx.cancelOperationProcessing();
+ }
+ return;
+ }
+
+ else
+ {
+ if (parts == null)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ else
+ result = AssertionResult.RESULT_PASSED;
+ return;
+ }
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+ }
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return;
+ }
+ }
+ }
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.ignoreImport();
+ traversal.traverse((Operation) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ errors.toString(),
+ entryContext,
+ entryContext.getEntry().getEntryDetail());
+ }
+ //else
+ // result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2017.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2017.java
new file mode 100644
index 000000000..64f4590dd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2017.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2017.
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>The "style" attribute of each operation in the contained soap:binding has the same value of "document" or "rpc", for all operations of the wsdl:binding.</assertionDescription>
+ */
+public class BP2017 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2017(WSDLValidatorImpl 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
+ {
+ //String firstStyle = null; // GT: is this needed??
+ Vector failureDetailList = new Vector();
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+ if (binding == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+ SOAPBinding soapB = WSDLValidatorImpl.getSoapBinding(binding);
+ if (soapB == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+ String styleB =
+ (soapB.getStyle() == null
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapB.getStyle());
+
+ // Try to get the SOAP operations
+ HashMap soapOperationList = validator.getSoapOperations(binding);
+
+ if (soapOperationList.isEmpty())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // check that they all have the same style element value
+ String style = null;
+ String checkStyle;
+ SOAPOperation soapOperation;
+ Iterator iterator = soapOperationList.keySet().iterator();
+ while (iterator.hasNext())
+ {
+ soapOperation = (SOAPOperation) iterator.next();
+ checkStyle = soapOperation.getStyle();
+ if (checkStyle == null)
+ checkStyle = styleB;
+ if (checkStyle != null
+ && !checkStyle.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC)
+ && !checkStyle.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailList.add(
+ this.validator.createFailureDetail(
+ "Operation Name: "
+ + soapOperationList.get(soapOperation)
+ + "\nSOAP Operation: "
+ + soapOperation.toString(),
+ entryContext,
+ soapOperation));
+ // REMOVE: Need to process all operations
+ //break;
+ }
+
+ if (style == null)
+ {
+ style = checkStyle;
+ }
+ else if (!style.equals(checkStyle) || !style.equals(styleB))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailList.add(
+ this.validator.createFailureDetail(
+ "Operation Name: "
+ + soapOperationList.get(soapOperation)
+ + "\nSOAP Operation: "
+ + soapOperation.toString(),
+ entryContext,
+ soapOperation));
+ // REMOVE: Need to process all operations
+ //break;
+ }
+ }
+
+ if (style == null)
+ {
+ // no style attribute was found in the SOAP operation(s) of the binding.
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetailList);
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2018.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2018.java
new file mode 100644
index 000000000..dd467cd89
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2018.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+
+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.report.AssertionResult;
+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;
+
+
+/**
+ * BP2018.
+ * <context>For a candidate Web service definition</context>
+ * <assertionDescription>The wsdl:types element occurs either as the first child in the WSDL namespace of the wsdl:definitions element if no wsdl:documentation or wsdl:import element is present; or immediately following the wsdl:documentation element(s) if they are present but wsdl:import(s) are not, or immediately following both the wsdl:documentation and wsdl:import elemen(s) if present.</assertionDescription>
+ */
+public class BP2018 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2018(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /*
+ * @param el - xml element
+ * @return if element is extensibility element returns true.
+ */
+ private boolean isExtensibilityElement(Element el)
+ {
+ boolean isEx = true;
+ isEx = isEx && !XMLUtils.equals(el, WSDL_BINDING);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DEFINITIONS);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DOCUMENTATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_FAULT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_IMPORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_INPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_MESSAGE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OPERATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OUTPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PART);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORTTYPE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_SERVICE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_TYPES);
+
+ return isEx;
+ }
+
+ /**
+ * Validates the test assertion.
+ * @see org.eclipse.wst.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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the location of the WSDL document
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+ try
+ {
+ // Parse the WSDL document as an XML file
+ Document doc =
+ validator.parseXMLDocumentURL(definition.getDocumentBaseURI(), null);
+
+ Element root = doc.getDocumentElement(); // get definition
+
+ Element types = XMLUtils.findChildElement((Element) root, WSDL_TYPES);
+
+ if (types != null)
+ {
+ Element el = XMLUtils.findPreviousSibling(types);
+ while (el != null)
+ {
+ if (!isExtensibilityElement(el) &&
+ ((!XMLUtils.equals(el, WSDL_IMPORT)) &&
+ (!XMLUtils.equals(el, WSDL_DOCUMENTATION))))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ String message = "The " + el.getLocalName() + " element must not precede the types element.";
+ failureDetail = this.validator.createFailureDetail(message, entryContext);
+ break;
+ }
+ el = XMLUtils.findPreviousSibling(el);
+ }
+ }
+ }
+
+ catch (Throwable t)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "An error occurred while processing the document at "
+ + definition.getDocumentBaseURI()
+ + ".\n\n"
+ + Utils.getExceptionDetails(t),
+ 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/wsdl/BP2019.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2019.java
new file mode 100644
index 000000000..5a670bf88
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2019.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.Utils;
+
+
+/**
+ * BP2019.
+ * <context>For a candidate wsdl:binding element, if the contained soap:binding element has a "style" attribute equal to "document" and soap:operations have "use" attribute equal to "literal":</context>
+ * <assertionDescription>The "namespace" attribute is not specified in any contained soapbind:body, soapbind:header, soapbind::headerfault, soapbind:fault elements </assertionDescription>
+ * @version 1.0.1 27.06.2003
+ * @author Vitali Fedosenko
+ */
+public class BP2019 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2019(WSDLValidatorImpl 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
+ {
+ boolean docLitFound = false;
+ String errantElements = new String("");
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ if (soapBinding != null)
+ {
+ String style =
+ (soapBinding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapBinding.getStyle();
+ if (style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC))
+ {
+ Vector soapElements = Utils.arrayToVector(this.validator.getSoapBodies(binding));
+ soapElements.addAll(Utils.arrayToVector(this.validator.getSoapFaults(binding)));
+ soapElements.addAll(Utils.arrayToVector(this.validator.getSoapHeaders(binding)));
+ soapElements.addAll(
+ Utils.arrayToVector(this.validator.getSoapHeaderFaults(binding)));
+
+ Iterator i = soapElements.iterator();
+ while (i.hasNext())
+ {
+ ExtensibilityElement soapElement =
+ (ExtensibilityElement) (i.next());
+ try
+ {
+ if (this.validator.isLiteral(soapElement))
+ {
+ docLitFound = true;
+ if (this.validator.namespaceFoundInSoapLiteral(soapElement))
+ {
+ errantElements += "\n--- " + (soapElement.toString());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ } // continue with clenched teeth
+ }
+ }
+ }
+
+ if (!docLitFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // If a namespace was not found then test assertion passed
+ if (errantElements.length() != 0)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "Failing elements:" + errantElements,
+ 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/wsdl/BP2020.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2020.java
new file mode 100644
index 000000000..428bf927e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2020.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+
+import org.apache.xerces.util.URI;
+import org.apache.xerces.util.URI.MalformedURIException;
+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.report.AssertionResult;
+
+
+/**
+* BP2020.
+* <context>For a candidate wsdl:binding element, if the style attribute of the contained soapbind:binding is "rpc"
+* and the use attribute is "literal".</context>
+* <assertionDescription>The namespace attribute is specified on all soapbind:body elements and the value of the
+* namespace attribute is an absolute URI. </assertionDescription>
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2020 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2020(WSDLValidatorImpl 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+ boolean rpcLitFound = false;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check style to make sure that it is rpc - the subject of the assertion
+ String style = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ if (soapBinding != null)
+ style =
+ (soapBinding.getStyle() == null
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : soapBinding.getStyle());
+
+ if ((soapBinding != null)
+ && (style.equals(WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC)))
+ {
+ // Get the list of SOAP body elements
+ SOAPBody[] soapBodies = this.validator.getSoapBodies(binding);
+
+ // Check for Soap operation namespace
+ boolean assertionFailure = false;
+ String namespaceURI = null;
+ for (int i = 0; i < soapBodies.length && !(assertionFailure); i++)
+ {
+ SOAPBody soapBody = soapBodies[i];
+ // Added check for null use value, since the default value is literal
+ if (soapBody.getUse() == null
+ || soapBody.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ rpcLitFound = true;
+ // If there is no namespace, then flag as a failure
+ if ((namespaceURI = soapBody.getNamespaceURI()) == null)
+ {
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+
+ // Else, verify that the namespace is an absolute URI
+ else
+ {
+ try
+ {
+ //URL url = new URL(namespaceURI);
+ URI uri = new URI(namespaceURI);
+ if (uri.getScheme() == null)
+ {
+ // no scheme implies not an absolute URI
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+ }
+ catch (MalformedURIException mue)
+ {
+ assertionFailure = true;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "--- SOAP BODY:\n"
+ + soapBody.toString()
+ + "\n--- BINDING QNAME:\n"
+ + binding.getQName(),
+ entryContext);
+ }
+
+ }
+ }
+ }
+ if (!rpcLitFound)
+ {
+ // style is rpc but no document use elements
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail = null;
+ }
+ else if (!assertionFailure)
+ { // If no assertion failure, then set result to passed
+ result = AssertionResult.RESULT_PASSED;
+ failureDetail = null;
+ }
+ }
+ else
+ {
+ // style is not rpc
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail = null;
+ }
+
+ // 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/wsdl/BP2021.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2021.java
new file mode 100644
index 000000000..105086ee5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2021.java
@@ -0,0 +1,112 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
+
+
+/**
+* BP2021.
+* <context>For a candidate wsdl:binding element</context>
+* <assertionDescription>The wsdl:input element and wsdl:output element of each operation uses the attribute name "part" with a Schema type of "NMTOKEN" and does not use "parts", for both soapbind:header elements and soapbind:headerfault elements. </assertionDescription>
+*
+* @version 1.0.1 27.06.2003
+* @author Vitali Fedosenko
+**/
+public class BP2021 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2021(WSDLValidatorImpl 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
+ {
+ //Operation operation = null;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get SOAP headers for this binding
+ SOAPHeader[] soapHeaders = this.validator.getSoapHeaders(binding);
+
+ if (soapHeaders.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ // Check each header to see if it has part element with NMTOKEN type
+ for (int header = 0;
+ header < soapHeaders.length
+ && result.equals(AssertionResult.RESULT_PASSED);
+ header++)
+ {
+ if ((soapHeaders[header].getPart() == null)
+ || (!XMLUtils.isNmtoken(soapHeaders[header].getPart())))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapHeaders[header].toString(), entryContext);
+ }
+ // Else, check the headerfault if there is one
+ else
+ {
+ List soapHeaderFaultList =
+ soapHeaders[header].getSOAPHeaderFaults();
+ Iterator iterator = soapHeaderFaultList.iterator();
+
+ // Check each header fault to see if it has part element with NMTOKEN type
+ while (iterator.hasNext()
+ && result.equals(AssertionResult.RESULT_PASSED))
+ {
+ SOAPHeaderFault soapHeaderFault =
+ (SOAPHeaderFault) iterator.next();
+ if ((soapHeaderFault.getPart() == null)
+ || (!XMLUtils.isNmtoken(soapHeaderFault.getPart())))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapHeaderFault.toString(), 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/wsdl/BP2022.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2022.java
new file mode 100644
index 000000000..1145d7f84
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2022.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2022.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>the name attribute is specified on the soapbind:fault element.</assertionDescription>
+**/
+public class BP2022 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2022(WSDLValidatorImpl 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
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of SOAP faults for the binding
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ if (soapFaults == null || soapFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ // check all soap:faults.
+ // MUST have a name attribute
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if (soapFault.getName() == null)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "soapbind:fault element : " + soapFault.toString(),
+ entryContext);
+ break;
+ }
+ }
+ }
+
+ // 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/wsdl/BP2023.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2023.java
new file mode 100644
index 000000000..20360aedd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2023.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2023.
+ * <context>For a candidate wsdl:binding element, with the "use" attribute present on the soapbind:fault element</context>
+ * <assertionDescription>The value of the attribute is "literal".</assertionDescription>
+ */
+public class BP2023 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2023(WSDLValidatorImpl 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
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of SOAP faults for the binding
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ if (soapFaults == null || soapFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ // check all soap:faults.
+ // MUST have a name attribute, and if a use attribute is specified, it MUST be value "literal"
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if ((soapFault.getUse() != null)
+ && (!soapFault
+ .getUse()
+ .equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ failureDetail =
+ this.validator.createFailureDetail(soapFault.toString(), entryContext);
+ break;
+ }
+ }
+ }
+
+ // 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/wsdl/BP2032.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2032.java
new file mode 100644
index 000000000..afd96dbbb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2032.java
@@ -0,0 +1,86 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.extensions.soap.SOAPFault;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2032.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>the name attribute that is specified on the soapbind:fault element matches the value specified on the parent element wsdl:fault.</assertionDescription>
+ */
+public class BP2032 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2032(WSDLValidatorImpl 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
+ {
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get list of Binding faults for the binding
+ BindingFault[] bindingFaults = this.validator.getAllBindingFaults(binding);
+
+ if (bindingFaults == null || bindingFaults.length == 0)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ else
+ {
+ // for each binding fault, compare the child soap:fault name with the binding fault name
+
+ for (int i = 0; i < bindingFaults.length; i++)
+ {
+ BindingFault bindingFault = bindingFaults[i];
+ SOAPFault soapFault = this.validator.getSoapFault(bindingFault);
+ if (soapFault == null
+ || soapFault.getName() == null
+ || bindingFault.getName() == null
+ || !bindingFault.getName().equals(soapFault.getName()))
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ failureDetail = this.validator.createFailureDetail(
+ soapFault == null ? null : soapFault.toString(), entryContext);
+ break;
+ }
+ }
+ }
+
+ // 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/wsdl/BP2034.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2034.java
new file mode 100644
index 000000000..c8e61e8d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2034.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+
+/**
+ * BP2034
+ *
+ * <context>For a candidate description within a WSDL document</context>
+ * <assertionDescription>The candidate description does not contain the namespace declaration xmlns:xml="http://www.w3.org/XML/1998/namespace".</assertionDescription>
+ */
+public class BP2034 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2034(WSDLValidatorImpl 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
+ {
+ // Getting wsdl:definition element
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types;
+ // Getting the namespace declaration xmlns:xml
+ String xmlNs = (String) def.getNamespaces().get("xml");
+ // If it exists and equals to "http://www.w3.org/XML/1998/namespace"
+ if (xmlNs != null && xmlNs.equals(WSIConstants.NS_URI_XML))
+ {
+ // setting assertion result to warning
+ result = AssertionResult.RESULT_WARNING;
+ }
+ // there is no namespace declaration xmlns:xml in the wsdl:definition
+ // element, checking whether the definition has wsdl:type element
+ else if ((types = def.getTypes()) != null)
+ {
+ // Getting the list of wsdl:schemaS
+ List extElems = types.getExtensibilityElements();
+ for (int i = 0; i < extElems.size(); i++)
+ {
+ // Getting wsdl:schema element
+ UnknownExtensibilityElement schema =
+ (UnknownExtensibilityElement) extElems.get(i);
+ // Getting a value of the attribute xmlns:xml
+ String attrValue = schema.getElement().getAttributeNS(
+ WSIConstants.NS_URI_XMLNS, "xml");
+ // If it equals to "http://www.w3.org/XML/1998/namespace",
+ if (WSIConstants.NS_URI_XML.equals(attrValue))
+ {
+ // setting assertion result to warning
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = validator.createFailureDetail("The namespace "
+ + "declaration nested in wsdl:schema element.", entryContext);
+ break;
+ }
+ }
+ }
+
+ // 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/wsdl/BP2098.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2098.java
new file mode 100644
index 000000000..6db653ee8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2098.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Import;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+
+
+/**
+ * BP2098.
+ * <context>For a candidate wsdl:import element</context>
+ * <assertionDescription>The "location" attribute is specified for the wsdl:import element, and has a non-empty value.</assertionDescription>
+ */
+public class BP2098 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2098(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Import im = (Import) entryContext.getEntry().getEntryDetail();
+ // suppose that if location is invalid, the definition equals to null
+ if (im.getLocationURI() == null || im.getLocationURI() == "")
+ errors.add(im.getNamespaceURI(), im.getLocationURI());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2101.java
new file mode 100644
index 000000000..f9a73efee
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2101.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2101.
+ * <context>For a candidate wsdl:definition, if it contains wsdl:import statements</context>
+ * <assertionDescription>Each wsdl:import statement is only used to import another WSDL description.</assertionDescription>
+ */
+public class BP2101 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2101(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ boolean importFound = false;
+
+ /* Create falure report if import contains reference to non WSDL description.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+
+ // by the way : WSDL4J throws Exception if imported WSDL is not resolved
+ // but documentation says that im.getDefinition() will be equal to null
+ if (im.getDefinition() == null)
+ errors.add(
+ im.getNamespaceURI()
+ + ":"
+ + im.getLocationURI()
+ + "\nImport element does not reference a WSDL definition.");
+ else
+ try
+ {
+ // try to parse WSDL according to the WSDL schema
+ validator.parseXMLDocumentURL(
+ im.getLocationURI(),
+ ((Definition)parent).getDocumentBaseURI(),
+ TestUtils.getWSDLSchemaLocation());
+ }
+ catch (Throwable t)
+ {
+ errors.add(
+ im.getNamespaceURI()
+ + ":"
+ + im.getLocationURI()
+ + "\n"
+ + Utils.getExceptionDetails(t));
+ }
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2102.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2102.java
new file mode 100644
index 000000000..d272b9d75
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2102.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.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;
+
+
+/**
+ * BP2102.
+ * <context>For a candidate wsdl:types element, with XML schema import elements</context>
+ * <assertionDescription>Each XML schema import statement (xsd:import) is only used to directly reference an XML schema definition, which has "schema" from XML namespace "http://www.w3.org/2001/XMLSchema" as root element. It does not contain a reference to another document embedding the XML schema definition (e.g. WSDL).</assertionDescription>
+ */
+public class BP2102 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2102(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean importFound = false;
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // parse WSDL as XML
+ try
+ {
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = t.getExtensibilityElements();
+
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ if (exts != null)
+ {
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement
+ && el.getElementType().equals(ELEM_XSD_SCHEMA))
+ testNode(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+
+ if (result.equals(AssertionResult.RESULT_FAILED))
+ {
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+ }
+ }
+
+ if (!importFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ catch (Throwable tt)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetail =
+ this.validator.createFailureDetail(
+ "WSDL document can not be processed",
+ entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Check node is xsd import and it is
+ * only used to directly reference an XML schema definition, which has "schema"
+ * from XML namespace "http://www.w3.org/2001/XMLSchema" as root element.
+ * And it does not contain a reference to another document embedding the XML schema
+ * definition (e.g. WSDL).
+ * @param n - Unknown extensibility element
+ */
+ private void testNode(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+
+ Element im = (Element) n;
+ // Getting the schemaLocation and the namespace attributes
+ Attr schemaLocation =
+ XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ Attr namespace = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ // If there is only the namespace attribute of import element
+ if (schemaLocation == null && namespace != null)
+ {
+ // Getting all the inline schemas of the wsdl definition
+ Map schemasMap = validator.wsdlDocument.getSchemas();
+ // If an inline schema imported is defined
+ if (schemasMap.keySet().contains(namespace.getValue()))
+ {
+ // If an inline schema imported is defined
+ // (that means the schema is valid),
+ // continue with the next element
+ n = n.getNextSibling();
+ continue;
+ }
+
+ // no schemaLocation so try the namespace
+ schemaLocation = namespace;
+ }
+
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ {
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ // !! ATTENTION
+ // root XSD SCHEMA SCHEMA is not valid
+ //Document schema = XMLUtils.parseXMLDocumentURL(schemaLocation.getValue(), XSD_SCHEMALOCATION, context);
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+
+ // If the import is valid, then check its contents
+ if (XMLUtils
+ .equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ // Check content of imported document
+ testNode(schema.getDocumentElement().getFirstChild(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+
+ else
+ {
+ throw new Exception();
+ }
+ }
+ catch (Throwable t)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = schemaLocation.getValue();
+ break;
+ }
+ }
+ else
+ {
+ //result = AssertionResult.RESULT_FAILED;
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ failureDetailMessage =
+ "schemaLocation == null and namespace == null";
+ break;
+ }
+ }
+ testNode(n.getFirstChild(), context);
+ }
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2103.java
new file mode 100644
index 000000000..4fda970fd
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2103.java
@@ -0,0 +1,130 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2103.
+ * <context>For each a candidate wsdl:definitions</context>
+ * <assertionDescription>For the referenced definitions as well as all imported
+ * descriptions, The XML schema import statement is only used within an xsd:schema
+ * element.</assertionDescription>
+ */
+public class BP2103 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2103(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* Check all unknown extensibility elements it is not xsd import.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ ExtensibilityElement el,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (el instanceof UnknownExtensibilityElement)
+ searchForImport(((UnknownExtensibilityElement) el).getElement());
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ //processWSDL(entryContext.getWSDLDocument().getFilename());
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.ignoreImport();
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Create falure report if node is xsd import.
+ * @param n - node
+ */
+ private void searchForImport(Node n)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ Attr a =
+ XMLUtils.getAttribute((Element) n, ATTR_XSD_SCHEMALOCATION);
+ String schemaLocation = (a != null) ? a.getValue() : "";
+ a = XMLUtils.getAttribute((Element) n, ATTR_XSD_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ errors.add(new QName(namespace, schemaLocation));
+ }
+
+ else
+ {
+ // if xsd:schema element is found -> process schema
+ if (!XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ searchForImport(n.getFirstChild());
+ }
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2104.java
new file mode 100644
index 000000000..792f365c3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2104.java
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.xml.namespace.QName;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.NullUtil;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2104.
+ * <context>For a candidate wsdl:import</context>
+ * <assertionDescription>The targetNamespace attribute on the wsdl:definitions element for the imported WSDL description has the same value as the namespace attribute on the wsdl:import element that imported the WSDL description.</assertionDescription>
+ */
+public class BP2104 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2104(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private boolean importFound = false;
+
+ /* Create falure report if namespace of wsdl:import does not equal targetnamespace in referenced wsdl.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+ Definition def = im.getDefinition();
+ if (def != null)
+ {
+ if (!NullUtil.equals(im.getNamespaceURI(), def.getTargetNamespace()))
+ errors.add(
+ new QName(im.getNamespaceURI(), im.getLocationURI()),
+ new QName(def.getTargetNamespace(), def.getDocumentBaseURI()));
+ }
+ }
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.ignoreReferences();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2105.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2105.java
new file mode 100644
index 000000000..b104c6d31
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2105.java
@@ -0,0 +1,232 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2105.
+ * <context>For a candidate wsdl:definitions</context>
+ * <assertionDescription>For the referenced definitions, as well as all imported descriptions, in the WSDL namespace under the wsdl:defintitions element, the wsdl:import element is either directly after the wsdl:documentation element or is the first child element if the wsdl:documentation element is not present.</assertionDescription>
+ */
+public class BP2105 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2105(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ private boolean importFound = false;
+
+ /*
+ * Check wsld import element is either directly after the wsdl:documentation element
+ * or is the first child element if the wsdl:documentation element is not present.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Import, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Import im, Object parent, WSDLTraversalContext ctx)
+ {
+ importFound = true;
+ if (im.getDefinition() != null && im.getLocationURI() != null)
+ processWSDL(im.getDefinition().getDocumentBaseURI());
+ }
+
+ /*
+ * Check element is extensibility.
+ * @param el - xml element
+ * @return boolean
+ */
+ private boolean isExtensibilityElement(Element el)
+ {
+ boolean isEx = true;
+ isEx = isEx && !XMLUtils.equals(el, WSDL_BINDING);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DEFINITIONS);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_DOCUMENTATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_FAULT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_IMPORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_INPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_MESSAGE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OPERATION);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_OUTPUT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PART);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORT);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_PORTTYPE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_SERVICE);
+ isEx = isEx && !XMLUtils.equals(el, WSDL_TYPES);
+
+ return isEx;
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ // Get the definition element that will be analyzed
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // If it doesn't contain any imports, then the result is notApplicable
+ if ((definition.getImports() == null)
+ || (definition.getImports().size() == 0))
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ // Else analyze the
+ else
+ {
+ processWSDL(definition.getDocumentBaseURI());
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse(
+ (Definition) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * the method loads WSDL and check structure
+ * @param location
+ */
+ private void processWSDL(String location)
+ {
+ try
+ {
+ // parses WSDL
+ Document doc = validator.parseXMLDocumentURL(location, null);
+ checkWSDL(doc.getDocumentElement()); // get definition
+ }
+ catch (Throwable t)
+ {
+ // ADD: add exception handling
+ //System.err.println("2105 - WSDL load failed");
+ errors.add(t.toString());
+ }
+ }
+
+ /*
+ * Create falure report contains information of node.
+ * @param root
+ */
+ private void createFailed(Node root)
+ {
+ Attr a = XMLUtils.getAttribute((Element) root, ATTR_WSDL_LOCATION);
+ String schemaLocation = (a != null) ? a.getValue() : "";
+ a = XMLUtils.getAttribute((Element) root, ATTR_WSDL_NAMESPACE);
+ String namespace = (a != null) ? a.getValue() : "";
+ errors.add(new QName(namespace, schemaLocation));
+ }
+
+ /*
+ * Check wsdl correspons assertion description.
+ * @param root - definition
+ */
+ private void checkWSDL(Node root)
+ {
+ if (root != null)
+ {
+ // Find the first import element
+ Element im = XMLUtils.findChildElement((Element) root, WSDL_IMPORT);
+
+ // Determine if a documentation element is present in the WSDL document
+ boolean documentIsPresent =
+ (XMLUtils.findChildElement((Element) root, WSDL_DOCUMENTATION)
+ != null);
+
+ // Verify that all import elements occur after a documentation element
+ while (im != null)
+ {
+ // Find elements that are previous to the import element
+ Element el = XMLUtils.findPreviousSibling(im);
+ if (el != null)
+ while (isExtensibilityElement(el) && el != null)
+ if (el != null)
+ el = XMLUtils.findPreviousSibling(el);
+
+ // If the wsdl:document elemnt is present
+ if (documentIsPresent && el != null)
+ {
+ if (!XMLUtils.equals(el, WSDL_DOCUMENTATION) && !XMLUtils.equals(el, WSDL_IMPORT))
+ createFailed(root);
+ }
+
+ // Else check if it is another wsdl: element
+ else if (el != null)
+ {
+ // If not the definitions element, then check for other wsdl: element
+ if (!XMLUtils.equals(el, WSDL_DEFINITIONS) && !XMLUtils.equals(el, WSDL_IMPORT))
+ {
+ if (el.getNamespaceURI().equals(WSIConstants.NS_URI_WSDL))
+ createFailed(root);
+ }
+ }
+
+ // Get the next import element
+ im = XMLUtils.findElement(im, WSDL_IMPORT);
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2107.java
new file mode 100644
index 000000000..7fffb0212
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2107.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP2107.
+ * <context>For a candidate wsdl:types element containing an xsd:schema element</context>
+ * <assertionDescription>The xsd:schema element contains a targetNamespace attribute with a valid and non-null value unless the xsd:schema element has xsd:import and/or xsd:annotation as its only child element(s).</assertionDescription>
+ */
+public class BP2107 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2107(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean schemaFound = false;
+ private ErrorList errors = new ErrorList();
+ //private String context;
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = t.getExtensibilityElements();
+ if (exts != null)
+ {
+ //context = entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement)
+ searchForSchema(((UnknownExtensibilityElement) el).getElement());
+ }
+ }
+
+ // context = entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ // processWSDL(entryContext.getWSDLDocument().getFilename());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!schemaFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Check node schema or load schema from inmport if it exists and process it.
+ * @param n - node
+ */
+ private void searchForSchema(Node n)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ {
+ schemaFound = true;
+ processSchema(n, null);
+ }
+
+ else
+ {
+ // if xsd:import element is found -> load schema and process schema
+ //if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ // loadSchema(n);
+ //else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild());
+ }
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * Load schema and process it.
+ * @param importNode - xsd:import element
+ */
+ //private void loadSchema(Node importNode)
+ //{
+ // Element im = (Element) importNode;
+ // Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // // try to parse imported XSD
+ // if (schemaLocation != null && schemaLocation.getValue() != null)
+ // try
+ // {
+ // // if any error or root element is not XSD schema -> error
+ // Document schema =
+ // validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+ // if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ // {
+ // Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ // String namespace = (a != null) ? a.getValue() : "";
+ // processSchema(schema.getDocumentElement(), namespace);
+ // }
+ // }
+ // catch (Throwable t)
+ // {
+ // // nothing. it's not a schema
+ // }
+ //}
+
+ /*
+ * Create falure report if it's not correspons assertion description.
+ * @param schema - xsd:schema
+ * @param namespace - namespace of schema
+ */
+ private void processSchema(Node schema, String namespace)
+ {
+ Attr a =
+ XMLUtils.getAttribute((Element) schema, ATTR_XSD_TARGETNAMESPACE);
+ String targetNamespace = (a != null) ? a.getValue() : null;
+
+ Node n = schema.getFirstChild();
+ // !! we suppose that xsd:import element is occured only within xsd:schema element
+ boolean containsOnlyImportAndAnnotation = true;
+ while (n != null)
+ {
+ if (n.getNodeType() == Node.ELEMENT_NODE)
+ {
+ containsOnlyImportAndAnnotation
+ &= (XMLUtils.equals(n, ELEM_XSD_IMPORT)
+ || XMLUtils.equals(n, ELEM_XSD_ANNOTATION));
+ }
+
+ //if (Node.ELEMENT_NODE == n.getNodeType() && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ // loadSchema(n);
+
+ n = n.getNextSibling();
+ }
+
+ // If the target namespace is not set and there are elements in addition to import and annotation, then error
+ if ((targetNamespace == null || targetNamespace.length() == 0)
+ && (!containsOnlyImportAndAnnotation))
+ {
+ errors.add(targetNamespace, XMLUtils.serialize((Element) schema));
+ }
+
+ if (namespace != null && !namespace.equals(targetNamespace))
+ {
+ errors.add(namespace, XMLUtils.serialize((Element) schema));
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2108.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2108.java
new file mode 100644
index 000000000..bf733f5dc
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2108.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.xml.namespace.QName;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
+
+
+/**
+ * BP2108.
+ * <context>For a candidate wsdl:types, with Array declarations either locally defined or from an imported description</context>
+ * <assertionDescription>The type soapenc:Array does not appear in these declarations, and the wsdl:arrayType attribute is not used in the type declaration.</assertionDescription>
+ */
+public class BP2108 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2108(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+
+ // Search the definitions in CandidateInfo to locate the definition element that contains the specified types element
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ // This should never happen, but if it does then throw an execption
+ throw new WSIException("Could not locate types element definition.");
+ }
+
+ else
+ {
+ TypesRegistry registry =
+ new TypesRegistry(
+ t,
+ definition.getDocumentBaseURI(),
+ validator);
+
+ Iterator it = registry.getArrayTypes().iterator();
+ while (it.hasNext())
+ errors.add((QName) it.next());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ 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/wsdl/BP2110.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2110.java
new file mode 100644
index 000000000..519b6f0c6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2110.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.xml.namespace.QName;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
+
+
+/**
+ * BP2110.
+ * <context>For a candidate wsdl:types</context>
+ * <assertionDescription>Array declaration wrapper elements does not use the naming convention ArrayOfXXX.</assertionDescription>
+ */
+public class BP2110 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2110(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_WARNING;
+
+ Types t = (Types) entryContext.getEntry().getEntryDetail();
+
+ // Search the definitions in CandidateInfo to locate the definition element that contains the specified types element
+ Definition definition = null;
+ if ((definition = validator.analyzerContext.getCandidateInfo().getDefinition(t))
+ == null)
+ {
+ // This should never happen, but if it does then throw an execption
+ throw new WSIException("Could not locate types element definition.");
+ }
+
+ else
+ {
+ TypesRegistry registry =
+ new TypesRegistry(
+ t,
+ definition.getDocumentBaseURI(),
+ validator);
+
+ Iterator it = registry.getElementList().iterator();
+ while (it.hasNext())
+ {
+ QName type = (QName) it.next();
+ if (type.getLocalPart().startsWith("ArrayOf"))
+ errors.add(type);
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ 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/wsdl/BP2111.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2111.java
new file mode 100644
index 000000000..b9d942ddf
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2111.java
@@ -0,0 +1,142 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2111.
+ * <context>For a candidate wsdl:binding, which contains a document-literal soap:binding</context>
+ *
+ * <assertionDescription>If the "parts" attribute is present, then the soapbind:body element(s) have at most one part listed in the parts attribute.</assertionDescription>
+ */
+public class BP2111 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2111(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean docLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Put in context soap binding's style
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * Verify style of soap operation is "document" if not then it's canceled process.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ /*
+ * If use of soap body is "literal" and parts of soap body is more than one it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ docLiteralFound = true;
+
+ List parts = body.getParts();
+ if (parts != null && parts.size() > 1)
+ //how to pick out one body from another one ?
+ errors.add(body.getElementType(), body.getNamespaceURI());
+ }
+ }
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!docLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2112.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2112.java
new file mode 100644
index 000000000..262bc9f34
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2112.java
@@ -0,0 +1,203 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+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.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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;
+
+
+/**
+ * BP2112.
+ * <context>For a candidate wsdl:binding, with a style "rpc" attribute and containing at least a soapbind:body element</context>
+ * <assertionDescription>No wsdl:part referred by such a soapbind:body element is defined using the "element" attribute.</assertionDescription>
+ */
+public class BP2112 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2112(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean rpcLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Put in context soap binding's style
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("bindingStyle", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.BindingOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ BindingOperation op,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ ctx.removeParameter("operationStyle");
+ }
+
+ /*
+ * Verify style of soap operation is "rpc" if not then it's canceled process.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ ctx.addParameter("operationStyle", operation.getStyle());
+ }
+
+ /*
+ * If use of soap body is "literal" and if at least one part is define using "element" attribute it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ String opStyle = (String) ctx.getParameter("operationStyle");
+ String bStyle = (String) ctx.getParameter("bindingStyle");
+
+ if ((opStyle == null
+ && !WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(bStyle))
+ || (opStyle != null
+ && !WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(opStyle)))
+ {
+ ctx.cancelBindingOperationProcessing();
+ return;
+ }
+ // assert use == "literal"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ rpcLiteralFound = true;
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null
+ || (parent instanceof BindingInput && op.getInput() == null)
+ || (parent instanceof BindingOutput && op.getOutput() == null))
+ return;
+
+ Message m =
+ (parent instanceof BindingInput)
+ ? op.getInput().getMessage()
+ : op.getOutput().getMessage();
+ // REMOVE: current message should equals to message given as entry
+ //if (m == null || message != m)
+ if (m == null)
+ return;
+
+ List parts =
+ WSDLUtil.getParts(
+ op,
+ m,
+ body,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC);
+ if (parts == null)
+ return;
+
+ /* check whether parts list contains a parts which uses
+ * element attribute. If so, part name will be added into
+ * errors set.
+ */
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ {
+ Part part = (Part) it.next();
+ if (part.getElementName() != null)
+ errors.add(part.getName());
+ }
+ }
+ }
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+ // save message
+ //message = (Message)entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitBindingOperation(true);
+ traversal.visitSOAPOperation(true);
+ traversal.visitSOAPBody(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!rpcLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2113.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2113.java
new file mode 100644
index 000000000..bd31cdc0d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2113.java
@@ -0,0 +1,159 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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;
+
+
+/**
+ * BP2113.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The soapbind:header, soapbind:headerfault and soapbind:fault elements only refer to wsdl:part element(s) that have been defined using the "element" attribute.</assertionDescription>
+ */
+public class BP2113 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2113(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /*
+ * Verify soap header uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ Definition d = (Definition) ctx.getParameter("definition");
+ Message m = d.getMessage(header.getMessage());
+ if (m != null)
+ checkPart(m.getPart(header.getPart()), ctx.getBinding());
+ }
+
+ /*
+ * Verify soap headerfault uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ Definition d = (Definition) ctx.getParameter("definition");
+ Message m = d.getMessage(fault.getMessage());
+ // if message or part is not found - NOT_APPLICABLE ????
+ if (m != null)
+ checkPart(m.getPart(fault.getPart()), ctx.getBinding());
+ }
+
+ /*
+ * Verify soap fault uses part is define using "element" attribute
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.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;
+ checkPart((Part) m.getOrderedParts(null).get(0), ctx.getBinding());
+ }
+
+ /*
+ * Verify part is define using "element" attribute.
+ * @param p - part
+ * @param b - binding
+ */
+ // refactoring
+ private void checkPart(Part p, Binding b)
+ {
+ if (p != null && p.getElementName() == null)
+ errors.add(b.getQName(), p.getName());
+ }
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);;
+ traversal.setVisitor(this);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+
+ Map m = new HashMap();
+ Definition def = entryContext.getWSDLDocument().getDefinitions();
+ WSDLUtil.expandDefinition(def);
+ m.put("definition", def);
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail(), m);
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2114.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2114.java
new file mode 100644
index 000000000..4b549d12c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2114.java
@@ -0,0 +1,278 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Fault;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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;
+
+
+/**
+ * BP2114.
+ * <context>For a candidate wsdl:binding element</context>
+ *
+ *
+ * <assertionDescription>Every wsdl:part from each wsdl:message in the associated
+ * wsdl:portType is referenced either by the soapbind:body, soapbind:header,
+ * soapbind:fault, or soapbind:headerfault.</assertionDescription>
+ */
+public class BP2114 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2114(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ // map Message QName -> set(Part name)
+ public Map messages = new HashMap();
+
+ /*
+ * Add to Map parts which used by message
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message m, Object parent, WSDLTraversalContext ctx)
+ {
+ if (m != null
+ && !messages.containsKey(m)
+ && m.getOrderedParts(null) != null)
+ {
+ Set s = new HashSet();
+ Iterator it = m.getOrderedParts(null).iterator();
+ while (it.hasNext())
+ s.add(((Part) it.next()).getName());
+
+ //messages.put(m.getQName(), s);
+ if (s.size() > 0)
+ {
+ messages.put(m.getQName(), s);
+ }
+ }
+ }
+
+ /*
+ * Put in context style of soap binding
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style != null)
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * Remove parts of soap body from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // String style = (String)ctx.getParameter("style");
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null)
+ return;
+ Message m = null;
+ if (parent instanceof BindingInput)
+ {
+ if (op.getInput() == null)
+ return;
+ m = op.getInput().getMessage();
+ }
+ else if (parent instanceof BindingOutput)
+ {
+ if (op.getOutput() == null)
+ return;
+ m = op.getOutput().getMessage();
+ }
+ if (m == null)
+ return;
+
+ // get parts
+ List parts = WSDLUtil.getParts(op, m, body, null);
+ if (parts == null)
+ return;
+
+ // iterate all parts and check
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ removePart(m.getQName(), ((Part) it.next()).getName());
+ }
+
+ /*
+ * Remove parts of soap header from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // we suppose that it possible to have legal message and part with null names
+ // ATTENTION
+ // should we add message which is referenced by header or headerfault to messages ?
+ removePart(header.getMessage(), header.getPart());
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // we suppose that it possible to have legal message and patr with null names
+ QName messageName = fault.getMessage();
+ if (messageName == null)
+ messageName = ctx.getSOAPHeader().getMessage();
+ removePart(messageName, fault.getPart());
+ }
+
+ /*
+ * Remove parts of soap fault from Map.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.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)
+ return;
+
+ // we suppose that SOAPFault.getName() corresponds to the abstract operation's fault name
+ Fault f = op.getFault(faultName);
+
+ // fault message should have 1 part
+ if (f == null
+ || f.getMessage() == null
+ || f.getMessage().getParts().size() != 1)
+ return;
+
+ Part p = (Part) f.getMessage().getOrderedParts(null).get(0);
+ removePart(f.getMessage().getQName(), p.getName());
+ }
+
+ /*
+ * Remove part from Map.
+ * @param messageName - message
+ * @param partName - part
+ */
+ // refatoring
+ private void removePart(QName messageName, String partName)
+ {
+ Set parts = (Set) messages.get(messageName);
+ if (parts != null)
+ {
+ parts.remove(partName);
+ if (parts.size() == 0)
+ messages.remove(messageName);
+ }
+ }
+
+ /*
+ * 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
+ {
+ result = AssertionResult.RESULT_WARNING;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitMessage(true);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+ traversal.visitSOAPOperation(true);
+
+ Binding b = (Binding) entryContext.getEntry().getEntryDetail();
+ traversal.traverse(b);
+
+ if (messages.size() > 0)
+ errors.add(b.getQName());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2115.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2115.java
new file mode 100644
index 000000000..be98298b9
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2115.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.TypesRegistry;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2115.
+ * <context>For a candidate wsdl:message</context>
+ * <assertionDescription>An "element" attribute on any wsdl:part element refers to a global element declaration.</assertionDescription>
+ */
+public class BP2115 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2115(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private TypesRegistry registry = null;
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Part, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Part part, Object parent, WSDLTraversalContext ctx)
+ {
+ if (part.getElementName() != null
+ && registry.getType(part.getElementName()) == null)
+ {
+ errors.add(ctx.getMessage().getQName());
+ ctx.cancelMessageProcessing();
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ registry =
+ new TypesRegistry(
+ entryContext.getWSDLDocument().getDefinitions(),
+ validator);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitPart(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Message) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2116.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2116.java
new file mode 100644
index 000000000..f19ff0991
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2116.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2116.
+ * <context>For a candidate wsdl:message element</context>
+ * <assertionDescription>The wsdl:message element does not contain part elements that use both "type" and "element" attributes.</assertionDescription>
+ */
+public class BP2116 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2116(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Part, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Part part, Object parent, WSDLTraversalContext ctx)
+ {
+ if (part.getElementName() != null && part.getTypeName() != null)
+ {
+ errors.add(ctx.getMessage().getQName());
+ ctx.cancelMessageProcessing();
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitPart(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Message) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2117.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2117.java
new file mode 100644
index 000000000..6709fa796
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2117.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2117.
+ * <context>For a candidate wsdl:binding element, referred to by an rpc-literal soap:binding</context>
+ * <assertionDescription>The rpc-literal binding does not have a namespace attribute specified on a contained soapbind:header, soapbind:headerfault, and soapbind:fault element.</assertionDescription>
+ */
+public class BP2117 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2117(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean rpcLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /*
+ * If use of soap body is "literal" and if at least one part is define using "element" attribute it creates falure report.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert use == "literal"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse())
+ && ((String) ctx.getParameter("style")).equals(
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC))
+ {
+ rpcLiteralFound = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeader header,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ check(header.getUse(), header.getNamespaceURI(), ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPHeaderFault fault,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ check(fault.getUse(), fault.getNamespaceURI(), ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx)
+ {
+ check(fault.getUse(), fault.getNamespaceURI(), ctx);
+ }
+
+ // refactoring
+ // check LITERAL use and != namespace
+ // canceling further processing
+ private void check(String use, String namespace, WSDLTraversalContext ctx)
+ {
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(use)
+ && namespace != null)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelProcessing();
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPHeader(true);
+ traversal.visitSOAPHeaderFault(true);
+ traversal.visitSOAPFault(true);
+ traversal.visitSOAPOperation(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!rpcLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2118.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2118.java
new file mode 100644
index 000000000..6a4a73385
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2118.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Operation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2118.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The list (or set) of wsdl:operation elements for the contained wsdl:binding is the same as the list of wsdl:operations for the referred wsdl:portType.</assertionDescription>
+ */
+public class BP2118 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2118(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Operation op, Object parent, WSDLTraversalContext ctx)
+ {
+ // assert parent instanceof BindingOperation
+ if (op == null)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelBindingProcessing();
+ ctx.cancelBindingOperationProcessing();
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ Binding b = (Binding) entryContext.getEntry().getEntryDetail();
+ // if operations count in port type and binding is differ -> error
+ if (b.getPortType() == null
+ || b.getPortType().getOperations().size()
+ != b.getBindingOperations().size())
+ errors.add(b.getQName());
+ else
+ {
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.traverse(b);
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2119.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2119.java
new file mode 100644
index 000000000..3de1a8342
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2119.java
@@ -0,0 +1,165 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Operation;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2119.
+ * <context>For a candidate wsdl:binding, which is of type document-literal</context>
+ * <assertionDescription>If it does not specify the parts attribute on a soapbind:body element, the corresponding abstract wsdl:message defines zero or one wsdl:part.</assertionDescription>
+ */
+public class BP2119 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2119(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean docLiteralFound = false;
+ private ErrorList errors = new ErrorList();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ String use =
+ (body.getUse() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT
+ : body.getUse();
+
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(use))
+ {
+ docLiteralFound = true;
+ if (body.getParts() == null)
+ {
+ Operation op = ctx.getBindingOperation().getOperation();
+ if (op == null)
+ return;
+
+ Map parts = null;
+ if (parent instanceof BindingInput)
+ {
+ if (op.getInput() == null || op.getInput().getMessage() == null)
+ return;
+ parts = op.getInput().getMessage().getParts();
+ }
+ else if (parent instanceof BindingOutput)
+ {
+ if (op.getOutput() == null || op.getOutput().getMessage() == null)
+ return;
+ parts = op.getOutput().getMessage().getParts();
+ }
+
+ if (parts != null && parts.size() > 1)
+ {
+ errors.add(ctx.getBinding().getQName());
+ // suppresses subsequent processing, because error list contains only failed binding
+ ctx.cancelBindingProcessing();
+ ctx.cancelBindingOperationProcessing();
+ ctx.cancelBindingInputProcessing();
+ ctx.cancelBindingOutputProcessing();
+ }
+ }
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!docLiteralFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2120.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2120.java
new file mode 100644
index 000000000..692728364
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2120.java
@@ -0,0 +1,247 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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;
+
+
+/**
+ * BP2120.
+ * <context>For a candidate wsdl:binding</context>
+ * <assertionDescription>Each operation referenced by the binding results in a unique wire signature.</assertionDescription>
+ */
+public class BP2120 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2120(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private Set wares = new HashSet();
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBinding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style != null)
+ ctx.addParameter("style", style);
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPBody, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ List signature = new LinkedList();
+
+ String style = (String) ctx.getParameter("style");
+
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+
+ // if some links are broken, cancel processing
+ if (op == null
+ || op.getInput() == null
+ || op.getInput().getMessage() == null)
+ return;
+ Message m = op.getInput().getMessage();
+
+ List parts = WSDLUtil.getParts(op, m, body, style);
+ if (parts == null)
+ return;
+ // !! ATTENTION
+ // may be required to add types instead of part into signature ?
+
+ // create signature
+ signature.addAll(parts);
+
+ // suppose that wire signature for
+ // - rpc style = operation name + parts' qname
+ // - document style = parts' qname
+ if (WSIConstants.ATTRVAL_SOAP_BIND_STYLE_RPC.equals(style))
+ signature.add(0, op.getName());
+
+ if (sameSignature(wares, signature))
+ errors.add(op.getName());
+ else
+ wares.add(signature);
+ }
+
+ /**
+ * Check if the signature is in the set match.
+ */
+ private boolean sameSignature(Set signatureSet, List signature)
+ {
+ boolean same = false;
+
+ // Get iterator for set
+ Iterator set = signatureSet.iterator();
+ while (set.hasNext() && !same)
+ {
+ // Get next signature from the set
+ List nextSignature = (List) set.next();
+
+ // Only continue if the signatures are the same size
+ if (nextSignature.size() == signature.size())
+ {
+ Iterator iterator1 = nextSignature.iterator();
+ Iterator iterator2 = signature.iterator();
+
+ // Assume same until a difference is found
+ same = true;
+
+ // Process each list until a difference is found
+ while (iterator1.hasNext() && iterator2.hasNext() && same)
+ {
+ // Get the next elements
+ Object element1 = iterator1.next();
+ Object element2 = iterator2.next();
+
+ // If the element is a string, then if equal check parts
+ if ((element1 instanceof String)
+ && (element2 instanceof String)
+ && (((String) element1).equals((String) element2)))
+ {
+ same = true;
+ }
+
+ // If the elements are parts, then check if they are equal
+ else if ((element1 instanceof Part) && (element2 instanceof Part))
+ {
+ same = sameParts((Part) element1, (Part) element2);
+ }
+
+ else
+ {
+ same = false;
+ }
+ }
+ }
+ }
+
+ return same;
+ }
+
+ /**
+ * Check if two parts are the same.
+ */
+ private boolean sameParts(Part part1, Part part2)
+ {
+ boolean same = false;
+
+ // If the part has an element then see if they are the same
+ if (part1.getElementName() != null
+ && part2.getElementName() != null
+ && part1.getElementName().equals(part2.getElementName()))
+ {
+ same = true;
+ }
+
+ // If the part has an type then see if they are the same
+ else if (
+ part1.getTypeName() != null
+ && part2.getTypeName() != null
+ && part1.getTypeName().equals(part2.getTypeName()))
+ {
+ same = true;
+ }
+
+ else
+ {
+ same = false;
+ }
+
+ return same;
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreBindingOutput();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ // !! ATTENTION
+ // Analyze soapbind:body:namespace and service targetNamespace
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2121.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2121.java
new file mode 100644
index 000000000..6ad594a36
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2121.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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;
+
+
+/**
+ * BP2121.
+ * Context:
+ * For a wsdl:binding element which is referenced directly or associated
+ * with a specified wsdl:port.
+ *
+ * Assertion Description:
+ * Each operation referenced by a document-literal binding must have a
+ * message definition where the wsdl:part references a global element
+ * definition.
+ */
+public class BP2121 extends AssertionProcessVisitor implements WSITag
+{
+
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2121(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private TypesRegistry registry = null;
+
+ public void visit(
+ SOAPBinding binding,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style =
+ (binding.getStyle() == null)
+ ? WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC
+ : binding.getStyle();
+ ctx.addParameter("style", style);
+ }
+ public void visit(
+ SOAPOperation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ String style = operation.getStyle();
+ if (style == null)
+ style = (String) ctx.getParameter("style");
+ // assert style != null
+ if (!WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC.equals(style))
+ ctx.cancelBindingOperationProcessing();
+ }
+
+ public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx)
+ {
+ // !! ATTENTION
+ // we suppose that soapbody child elements is its parts.
+ // assert style == "document"
+ if (WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT.equals(body.getUse()))
+ {
+ // find corresponding message
+ Operation op = ctx.getBindingOperation().getOperation();
+ // if some links are broken, cancel processing
+ if (op == null
+ || (parent instanceof BindingInput && op.getInput() == null)
+ || (parent instanceof BindingOutput && op.getOutput() == null))
+ return;
+
+ Message m =
+ (parent instanceof BindingInput)
+ ? op.getInput().getMessage()
+ : op.getOutput().getMessage();
+ if (m == null)
+ return;
+
+ // find parts which are involved in the given body
+ List parts =
+ WSDLUtil.getParts(
+ op,
+ m,
+ body,
+ WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC);
+ if (parts == null)
+ return;
+
+ // check parts
+ Iterator it = parts.iterator();
+ while (it.hasNext())
+ {
+ Part p = (Part) it.next();
+ // check whether p declared as global element
+ if (p.getElementName() == null
+ || registry.getType(p.getElementName()) == null)
+ {
+ errors.add(op.getName());
+ // suppresses subsequent processing, because error list contains only failed operation
+ ctx.cancelBindingOperationProcessing();
+ }
+ }
+ }
+ }
+
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ registry =
+ new TypesRegistry(
+ entryContext.getWSDLDocument().getDefinitions(),
+ validator);
+
+ // collect all types from messages to checkedParts map
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitSOAPBinding(true);
+ traversal.visitSOAPBody(true);
+ traversal.visitSOAPOperation(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ 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/wsdl/BP2122.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2122.java
new file mode 100644
index 000000000..f6caf111f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2122.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.List;
+
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+
+
+/**
+ * BP2122.
+ * <context>For a candidate wsdl:types element</context>
+ * <assertionDescription>The data type definition if any within the wsdl:types element is an XML schema definition defined in the XML Schema 1.0 Recommendation with the namespace URI "http://www.w3.org/2001/XMLSchema".</assertionDescription>
+ */
+public class BP2122 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2122(WSDLValidatorImpl 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
+ {
+ result = AssertionResult.RESULT_PASSED;
+ ErrorList errorList = new ErrorList();
+
+ // Get the types from the entry context
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+
+ if (types != null)
+ {
+ ExtensibilityElement extElement;
+ List extElements = types.getExtensibilityElements();
+
+ // Process each ext. element
+ for (int i = 0; i < extElements.size(); i++)
+ {
+ // If it is an unknown ext. element and it is a schema, then check it
+ if ((extElement = (ExtensibilityElement) extElements.get(i))
+ instanceof UnknownExtensibilityElement)
+ {
+ if (!extElement.getElementType().equals(WSITag.ELEM_XSD_SCHEMA))
+ {
+ // If it is not a schema definition, then it is an error
+ errorList.add(
+ extElement.getElementType().toString()
+ + " can not be a child of the wsdl:types element.");
+ }
+ }
+ }
+ }
+
+ // If XMLSchemaValidator could not find any errors, check errors from the inline schema validator
+ if (errorList.isEmpty())
+ errorList.add(validator.wsdlDocument.getSchemasValidationErrors());
+
+ if (!errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errorList.toString(), 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/wsdl/BP2123.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2123.java
new file mode 100644
index 000000000..af5f833d2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2123.java
@@ -0,0 +1,357 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+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.report.AssertionResult;
+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.Element;
+
+
+/**
+ * BP2123.
+ * <context>For a candidate wsdl:definitions, if it contains a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message</context>
+ * <assertionDescription>Contained WSDL extension elements do not use the wsdl:required attribute value of "true".</assertionDescription>
+ */
+public class BP2123 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2123(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean claimFound = false;
+
+ private static final String PORT_KEY = "port";
+ private static final String BINDING_KEY = "binding";
+ private static final String PORT_TYPE_KEY = "port type";
+ private static final String OPERATION_KEY = "operation";
+ private static final String MESSAGE_KEY = "message";
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null)
+ {
+ if (containsLegalClaim(port.getDocumentationElement()))
+ {
+ claimFound = true;
+ ctx.addParameter(PORT_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ ctx.addParameter(PORT_KEY, Boolean.FALSE);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null)
+ {
+ Boolean port = (Boolean) ctx.getParameter(PORT_KEY);
+
+ if (port.booleanValue())
+ {
+ ctx.addParameter(BINDING_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(binding.getDocumentationElement());
+ ctx.addParameter(
+ BINDING_KEY,
+ new Boolean(containsLegalClaim(binding.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.PortType, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(PortType type, Object parent, WSDLTraversalContext ctx)
+ {
+ if (type != null)
+ {
+ Boolean binding = (Boolean) ctx.getParameter(BINDING_KEY);
+
+ if (binding.booleanValue())
+ {
+ ctx.addParameter(PORT_TYPE_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(type.getDocumentationElement());
+ ctx.addParameter(
+ PORT_TYPE_KEY,
+ new Boolean(containsLegalClaim(type.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null)
+ {
+ Boolean type = (Boolean) ctx.getParameter(PORT_TYPE_KEY);
+
+ if (type.booleanValue())
+ {
+ ctx.addParameter(OPERATION_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(operation.getDocumentationElement());
+ ctx.addParameter(
+ OPERATION_KEY,
+ new Boolean(
+ containsLegalClaim(operation.getDocumentationElement())));
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null)
+ {
+ Boolean operation = (Boolean) ctx.getParameter(OPERATION_KEY);
+
+ if (operation.booleanValue())
+ {
+ ctx.addParameter(MESSAGE_KEY, Boolean.TRUE);
+ }
+ else
+ {
+ claimFound = containsClaim(message.getDocumentationElement());
+ ctx.addParameter(
+ MESSAGE_KEY,
+ new Boolean(containsLegalClaim(message.getDocumentationElement())));
+ }
+ }
+ }
+
+ /*
+ public void visit(BindingOperation operation, Object parent, WSDLTraversalContext ctx) {
+ if (operation != null) {
+ if (containsLegalClaim(operation.getDocumentationElement())) {
+ System.out.println("binding operation found");
+ } else {
+
+ }
+ }
+ }
+ */
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+
+ public void visit(
+ ExtensibilityElement el,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ boolean required =
+ el != null
+ && el.getRequired() != null
+ && el.getRequired().booleanValue();
+
+ if (isParentConforms(parent, ctx))
+ {
+ if (required)
+ {
+ result = AssertionResult.RESULT_WARNING;
+ failureDetailMessage = el.toString();
+ }
+ }
+ }
+
+ /**
+ * Indicates whether the parent element conforms to the basic profile.
+ * @param parent
+ * @param ctx
+ * @return boolean
+ */
+ private boolean isParentConforms(Object parent, WSDLTraversalContext ctx)
+ {
+ boolean result = false;
+
+ if (parent instanceof Port)
+ {
+ result = ((Boolean) ctx.getParameter(PORT_KEY)).booleanValue();
+ }
+ else if (
+ parent instanceof Binding
+ || parent instanceof BindingOperation
+ || parent instanceof BindingInput
+ || parent instanceof BindingOutput
+ || parent instanceof BindingFault)
+ {
+ result = ((Boolean) ctx.getParameter(BINDING_KEY)).booleanValue();
+ }
+ else if (parent instanceof PortType)
+ {
+ result = ((Boolean) ctx.getParameter(PORT_TYPE_KEY)).booleanValue();
+ }
+ else if (
+ parent instanceof Operation
+ || parent instanceof Input
+ || parent instanceof Output
+ || parent instanceof Fault)
+ {
+ result = ((Boolean) ctx.getParameter(OPERATION_KEY)).booleanValue();
+ }
+ else if (parent instanceof Message || parent instanceof Part)
+ {
+ result = ((Boolean) ctx.getParameter(MESSAGE_KEY)).booleanValue();
+ }
+
+ return result;
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext)
+ */
+ public AssertionResult validate(
+ TestAssertion testAssertion,
+ EntryContext entryContext)
+ throws WSIException
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Expect wsdl:defintions
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ //((Service)def.getServices().values().toArray()[0]).getPorts()
+ // Traverse WSDL
+ WSDLTraversal traversal = new WSDLTraversal();
+ // VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+ traversal.visitPortType(true);
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreDefinition2Binding();
+ traversal.ignoreDefinition2Element();
+ traversal.ignoreDefinition2ExtensibilityElement();
+ traversal.ignoreDefinition2Message();
+ traversal.ignoreDefinition2PortType();
+ traversal.ignoreDefinition2Types();
+
+ traversal.traverse(def);
+
+ if (!claimFound)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else if (result.equals(AssertionResult.RESULT_WARNING))
+ {
+ failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * legal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ if (el != null)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * legal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsLegalClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ while (el != null)
+ {
+ String value = el.getAttribute(ATTR_CLAIM_CONFORMSTO.getLocalPart());
+ if (value != null
+ && value.equalsIgnoreCase(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE))
+ {
+ return true;
+ }
+
+ el = XMLUtils.findElement(el, WSI_CLAIM);
+ }
+ 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/wsdl/BP2201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2201.java
new file mode 100644
index 000000000..324ddfc3e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2201.java
@@ -0,0 +1,189 @@
+/*******************************************************************************
+ * 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.wsdl;
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+
+import javax.wsdl.Definition;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.StringTokenizer;
+
+/**
+ * BP2201.
+ * <context>For a candidate Web service definition within a WSDL document with a XML declaration statement. </context>
+ * <assertionDescription>The XML declaration statement uses UTF-8 or UTF-16 for the encoding. </assertionDescription>
+ */
+public class BP2201 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS = new char[]{0x20,
+ 0x9, 0xD, 0xA, '\'', '\"'};
+ private final char[] XML_DECLARATION_DELIMITERS = new char[]{'='};
+ private final String UTF_8_ENCODING = "UTF-8";
+ private final String UTF_16_ENCODING = "UTF-16";
+ private final String ENCODING_TOKEN = "encoding";
+ /*
+ * (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
+ {
+ result = AssertionResult.RESULT_PASSED;
+ Definition definition = (Definition) entryContext.getEntry()
+ .getEntryDetail();
+ String location = definition.getDocumentBaseURI();
+ String xmlDecl = readXMLDeclarationStatement(location);
+ if (xmlDecl == null)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ } else
+ {
+ if (!validEncoding(xmlDecl))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(xmlDecl, entryContext);
+ }
+ }
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+ /**
+ * Reads an XML declaration statement.
+ *
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location)
+ {
+ String result = null;
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ } catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ } else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+ char[] c = new char[4];
+ reader.read(c);
+ StringBuffer buf = new StringBuffer();
+ if (new String(c).toLowerCase().equals("?xml"))
+ {
+ buf.append("<?xml");
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+ end = charCode == '>';
+ }
+ } else
+ {
+ // NOTE: This result does not get propogated back!
+ this.result = AssertionResult.RESULT_NOT_APPLICABLE;
+ return null;
+ }
+ result = buf.toString();
+ }
+ } catch (Exception e)
+ {
+ //VERBOSE
+ if (validator.verboseOption)
+ {
+ System.err.println(" [WSI2201] Exception: " + e.getMessage());
+ }
+ } finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ } catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+ return result;
+ }
+ /*
+ * Verify xml declaration contains utf-16 or utf-8 encoding. @param xmlDecl -
+ * xml declaration @return
+ */
+ private boolean validEncoding(String xmlDecl)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st = new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS, XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+ if (token.equals(ENCODING_TOKEN))
+ {
+ found = true;
+ tokens.nextElement();
+ String enc = (String) tokens.nextElement();
+ result = UTF_8_ENCODING.equalsIgnoreCase(enc)
+ || UTF_16_ENCODING.equalsIgnoreCase(enc);
+ }
+ }
+ }
+ return result;
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2202.java
new file mode 100644
index 000000000..64c793426
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2202.java
@@ -0,0 +1,420 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.io.FileInputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.util.StringTokenizer;
+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;
+
+
+/**
+ * BP2202.
+ * <context>For a candidate wsdl:types element within a WSDL document which imports an XML schema directly or indirectly.</context>
+ * <assertionDescription>The imported schema uses UTF-8 or UTF-16 for the encoding.</assertionDescription>
+ */
+public class BP2202 extends AssertionProcess implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private boolean importFound = false;
+
+ private final char[] OMMITED_XML_DECLARATION_DELIMITERS =
+ new char[] { 0x20, 0x9, 0xD, 0xA, '\'', '\"' };
+ private final char[] XML_DECLARATION_DELIMITERS = new char[] { '=' };
+ private final String UTF_8_ENCODING = "UTF-8";
+ private final String UTF_16_ENCODING = "UTF-16";
+
+ private final String ENCODING_TOKEN = "encoding";
+
+ /* (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
+ {
+ result = result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ //Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+ Types types = (Types) entryContext.getEntry().getEntryDetail();
+ List exts = null;
+ //if (def.getTypes() != null)
+ if (types != null)
+ //exts = def.getTypes().getExtensibilityElements();
+ exts = types.getExtensibilityElements();
+ if (exts != null)
+ {
+ Definition definition = null;
+ if ((definition =
+ validator.analyzerContext.getCandidateInfo().getDefinition(types))
+ == null)
+ {
+ throw new WSIException("Could not find types definition in any WSDL document.");
+ }
+
+ Iterator it = exts.iterator();
+ while (it.hasNext())
+ {
+ ExtensibilityElement el = (ExtensibilityElement) it.next();
+ if (el instanceof UnknownExtensibilityElement
+ && el.getElementType().equals(ELEM_XSD_SCHEMA))
+ searchForSchema(((UnknownExtensibilityElement) el).getElement(),
+ definition.getDocumentBaseURI());
+ }
+ }
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else if (!importFound)
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /*
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param n - node
+ */
+ private void searchForSchema(Node n, String context)
+ {
+ while (n != null)
+ {
+ // searches for xsd:import element
+ if (Node.ELEMENT_NODE == n.getNodeType())
+ {
+ // if xsd:schema element is found -> process schema
+ if (XMLUtils.equals(n, ELEM_XSD_SCHEMA))
+ {
+ processSchema(n, context);
+ }
+ else
+ {
+ // if xsd:import element is found -> load schema and process schema
+ if (XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+ loadSchema(n, context);
+ }
+ else
+ // else iterate element recursively
+ searchForSchema(n.getFirstChild(), context);
+ }
+ }
+ n = n.getNextSibling();
+ }
+ }
+
+ /*
+ * It loads xsd schema and then check valid encoding and looking for xsd:schema element for next process.
+ * @param importNode - xsd schema
+ */
+ private void loadSchema(Node importNode, String context)
+ {
+ Element im = (Element) importNode;
+ Attr schemaLocation = XMLUtils.getAttribute(im, ATTR_XSD_SCHEMALOCATION);
+ // try to parse imported XSD
+ if (schemaLocation != null && schemaLocation.getValue() != null)
+ try
+ {
+ // if any error or root element is not XSD schema -> error
+ String decl =
+ readXMLDeclarationStatement(schemaLocation.getValue(), context);
+ if (!validDeclaration(decl,
+ ENCODING_TOKEN,
+ new String[] { UTF_8_ENCODING, UTF_16_ENCODING }))
+ {
+ Attr a = XMLUtils.getAttribute(im, ATTR_XSD_NAMESPACE);
+ errors.add((a != null) ? a.getValue() : "");
+ }
+
+ if (!validDeclaration(decl, "version", new String[] { "1.0" }))
+ {
+ errors.add(
+ "Version number in XML declaration is not 1.0. XML schema file: "
+ + schemaLocation.getValue());
+ }
+
+ // DEBUG:
+ // System.out.println(schemaLocation.getValue() + ":" + context);
+
+ Document schema =
+ validator.parseXMLDocumentURL(schemaLocation.getValue(), context);
+
+ if (XMLUtils.equals(schema.getDocumentElement(), ELEM_XSD_SCHEMA))
+ {
+ processSchema(schema.getDocumentElement(),
+ XMLUtils.createURLString(schemaLocation.getValue(), context));
+ }
+ result = result = AssertionResult.RESULT_PASSED;
+ }
+ catch (Throwable t)
+ {
+ }
+ }
+
+ /**
+ * Reads an XML declaration statement.
+ * @param location
+ * @return String
+ */
+ private String readXMLDeclarationStatement(String location, String baseURI)
+ {
+ String result = null;
+ try
+ {
+ new URL(location);
+ }
+ catch (Throwable t)
+ {
+ // nothing
+ int i = baseURI.lastIndexOf('/');
+ int j = baseURI.lastIndexOf('\\');
+ if (j > i)
+ i = j;
+ location = baseURI.substring(0, i + 1) + location;
+ }
+
+ if (location != null)
+ {
+ URL url = null;
+ Reader reader = null;
+
+ try
+ {
+ try
+ {
+ url = new URL(location);
+ }
+ catch (MalformedURLException e)
+ {
+ // we should try to access location as file
+ }
+
+ if (url != null)
+ {
+ reader = new InputStreamReader(url.openStream());
+ }
+ else
+ {
+ reader = new InputStreamReader(new FileInputStream(location));
+ }
+
+ int charCode;
+ boolean end = false;
+ if (reader.ready())
+ {
+ charCode = reader.read();
+
+ while (reader.ready() && !(charCode == '<'))
+ {
+ charCode = reader.read();
+ }
+
+ StringBuffer buf = new StringBuffer();
+ if (charCode == '<')
+ {
+ buf.append((char) charCode);
+ while (reader.ready() && !end)
+ {
+ charCode = reader.read();
+ buf.append((char) charCode);
+
+ end = charCode == '>';
+ }
+ }
+ else
+ {
+ // NOTE: This result does not get propogated back!
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ "Cannot read the XML declaration statement.";
+ }
+
+ result = buf.toString();
+ }
+ }
+ catch (Exception e)
+ {
+ errors.add(e.getMessage());
+ }
+ finally
+ {
+ if (reader != null)
+ {
+ try
+ {
+ reader.close();
+ }
+ catch (Throwable e)
+ {
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains encoding="utf-16" or encoding="utf-8" it retirns true.
+ */
+
+ //private boolean validEncoding(String xmlDecl)
+ //{
+ // //boolean result = false;
+ // boolean result = true;
+ // if (xmlDecl != null)
+ // {
+ // StringTokenizer st =
+ // new StringTokenizer(
+ // OMMITED_XML_DECLARATION_DELIMITERS,
+ // XML_DECLARATION_DELIMITERS);
+ // Enumeration tokens = st.parse(xmlDecl);
+ // boolean found = false;
+ // while (tokens.hasMoreElements() && !found)
+ // {
+ // String token = (String) tokens.nextElement();
+ //
+ // if (token.equals(ENCODING_TOKEN))
+ // {
+ // found = true;
+ //
+ // tokens.nextElement();
+ // String enc = (String) tokens.nextElement();
+ //
+ // result =
+ // UTF_8_ENCODING.equalsIgnoreCase(enc)
+ // || UTF_16_ENCODING.equalsIgnoreCase(enc);
+ // }
+ // }
+ // }
+ //
+ // return result;
+ //}
+
+ /**
+ * @param xmlDecl - xml declaration
+ * @return if xml declaration contains valid version number then true is returned.
+ */
+ private boolean validDeclaration(
+ String xmlDecl,
+ String tokenName,
+ String[] checkValueList)
+ {
+ //boolean result = false;
+ boolean result = true;
+ if (xmlDecl != null)
+ {
+ StringTokenizer st =
+ new StringTokenizer(
+ OMMITED_XML_DECLARATION_DELIMITERS,
+ XML_DECLARATION_DELIMITERS);
+ Enumeration tokens = st.parse(xmlDecl);
+
+ if (tokens.hasMoreElements())
+ {
+ boolean found = false;
+ while (tokens.hasMoreElements() && !found)
+ {
+ String token = (String) tokens.nextElement();
+
+ if (token.equals(tokenName))
+ {
+ found = true;
+ result = false;
+
+ tokens.nextElement();
+ String tokenValue = (String) tokens.nextElement();
+
+ for (int i = 0; i < checkValueList.length && !result; i++)
+ {
+ if (checkValueList[i].equalsIgnoreCase(tokenValue))
+ result = true;
+ }
+ }
+ }
+ }
+
+ // If there are no tokens then it is not a valid declaraction
+ else
+ {
+ result = false;
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * It's looking for xsd import and load it if find.
+ * @param schema - xsd schema
+ * @param namespace - namespace of schema
+ */
+ private void processSchema(Node schema, String context)
+ {
+ Node n = schema.getFirstChild();
+ while (n != null)
+ {
+ if (Node.ELEMENT_NODE == n.getNodeType()
+ && XMLUtils.equals(n, ELEM_XSD_IMPORT))
+ {
+ importFound = true;
+ loadSchema(n, context);
+ }
+
+ n = n.getNextSibling();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2208.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2208.java
new file mode 100644
index 000000000..c35963300
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2208.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Operation;
+import javax.wsdl.OperationType;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2208.
+ * <context>For a candidate wsdl:operation in a wsdl:portType definition</context>
+ * <assertionDescription>The wsdl:operation element is either a WSDL request/response or a one-way operation (no Notification or Sollicit-Response).</assertionDescription>
+ */
+public class BP2208 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2208(WSDLValidatorImpl 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
+ {
+
+ Operation operation =
+ (Operation) entryContext.getEntry().getEntryDetail();
+ OperationType opType = operation.getStyle();
+ if ((opType == null)
+ || (!opType.equals(OperationType.ONE_WAY)
+ && !opType.equals(OperationType.REQUEST_RESPONSE)))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ if (opType == null)
+ failureDetail =
+ this.validator.createFailureDetail(
+ "Could not determine the operation type for "
+ + operation.getName()
+ + ".",
+ entryContext);
+ else
+ failureDetail = null; // none defined in TAD at present
+ }
+
+ // 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/wsdl/BP2402.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2402.java
new file mode 100644
index 000000000..74f3da49e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2402.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2402.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The wsdl:binding element has a soapbind:binding child element.</assertionDescription>
+ */
+public class BP2402 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2402(WSDLValidatorImpl 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ // Get the port from the entry context
+ //Port port = (Port) entryContext.getEntry().getEntryDetail();
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check that there is at least one SOAP Binding
+ if (soapBinding != null)
+ {
+ result = AssertionResult.RESULT_PASSED;
+ failureDetail = null;
+ }
+
+ // 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/wsdl/BP2404.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2404.java
new file mode 100644
index 000000000..688e8d506
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2404.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBinding;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2404.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The contained soap:binding element has a "transport" attribute, which has value: http://schemas.xmlsoap.org/soap/http.</assertionDescription>
+ */
+public class BP2404 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2404(WSDLValidatorImpl 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
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Try to get the SOAP binding
+ SOAPBinding soapBinding = WSDLValidatorImpl.getSoapBinding(binding);
+
+ // Test the assertion
+ // Check for Soap binding namespace
+ if ((soapBinding == null)
+ || (soapBinding.getTransportURI() == null)
+ || !soapBinding.getTransportURI().equals(WSIConstants.NS_URI_SOAP_HTTP))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ this.validator.createFailureDetail(
+ soapBinding == null
+ ? "WSDL document does not contain SOAP binding element."
+ : soapBinding.toString(),
+ 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/wsdl/BP2406.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2406.java
new file mode 100644
index 000000000..9d5d8ed2a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2406.java
@@ -0,0 +1,166 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2406.
+ * <context>For a candidate wsdl:binding element, if the use attribute is specified on the soapbind:body, soapbind:fault, soapbind:header, or soapbind:headerfault elements.</context>
+ * <assertionDescription>The use attribute has a value of "literal".</assertionDescription>
+ */
+public class BP2406 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2406(WSDLValidatorImpl 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
+ {
+
+ // Get the binding from the entry context
+ Binding binding = (Binding) entryContext.getEntry().getEntryDetail();
+
+ // Get SOAP body elements
+ SOAPBody[] soapBodies = this.validator.getSoapBodies(binding);
+
+ // ADD: What happens if there are no soap body elements? Right now the TA result is NA.
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapBodies.length; i++)
+ {
+ SOAPBody soapBody = soapBodies[i];
+ if (soapBody.getUse() != null
+ && !soapBody.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail =
+ this.validator.createFailureDetail(soapBody.toString(), entryContext);
+ break;
+ }
+ }
+
+ // Get SOAP fault elements
+ SOAPFault[] soapFaults = this.validator.getSoapFaults(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapFaults.length; i++)
+ {
+ SOAPFault soapFault = soapFaults[i];
+ if (soapFault.getUse() != null
+ && !soapFault.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapFault.toString()
+ : failureDetailMessage + "\n\n" + soapFault.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // Get SOAP header elements
+ SOAPHeader[] soapHeaders = this.validator.getSoapHeaders(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapHeaders.length; i++)
+ {
+ SOAPHeader soapHeader = soapHeaders[i];
+ if (soapHeader.getUse() != null
+ && !soapHeader.getUse().equals(WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapHeader.toString()
+ : failureDetailMessage + "\n\n" + soapHeader.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // Get SOAP header fault elements
+ SOAPHeaderFault[] soapHeaderFaults = this.validator.getSoapHeaderFaults(binding);
+
+ // Test the assertion
+ // Check for correct use value
+ for (int i = 0; i < soapHeaderFaults.length; i++)
+ {
+ SOAPHeaderFault soapHeaderFault = soapHeaderFaults[i];
+ if (soapHeaderFault.getUse() != null
+ && !soapHeaderFault.getUse().equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage =
+ (failureDetailMessage == null
+ ? soapHeaderFault.toString()
+ : failureDetailMessage + "\n\n" + soapHeaderFault.toString());
+ if (failureDetail == null)
+ failureDetail =
+ this.validator.createFailureDetail(failureDetailMessage, entryContext);
+ else
+ failureDetail.setFailureMessage(failureDetailMessage);
+ break;
+ }
+ }
+
+ // If the result is passed, but there was nothing to check then set to notApplicable
+ if (result == AssertionResult.RESULT_PASSED
+ && (soapBodies == null || soapBodies.length == 0)
+ && (soapFaults == null || soapFaults.length == 0)
+ && (soapHeaders == null || soapHeaders.length == 0)
+ && (soapHeaderFaults == null || soapHeaderFaults.length == 0))
+ {
+ 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/wsdl/BP2416.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2416.java
new file mode 100644
index 000000000..1a1eba328
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2416.java
@@ -0,0 +1,209 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Input;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+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.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+* BP2416.
+* <context>For a candidate wsdl:definitions</context>
+* <assertionDescription>Every QName in the WSDL document and its imports, is referencing an element in a namespace that has either been imported or defined in the WSDL document that contains the reference.</assertionDescription>
+*/
+public class BP2416 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2416(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private static final String NS_LIST_KEY = "namespaces";
+
+ /**
+ * Checks whether the namespace is defined or imported in the definition.
+ * @param qname
+ * @param ctx
+ */
+ private void checkNamespace(QName qname, WSDLTraversalContext ctx)
+ {
+ if (qname != null)
+ {
+ String namespace = qname.getNamespaceURI();
+
+ if (namespace != null)
+ {
+ List namespaces = (List) ctx.getParameter(NS_LIST_KEY);
+
+ if (!namespaces.contains(namespace))
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetailMessage = namespace;
+
+ ctx.cancelProcessing();
+ }
+ } // ??? should we do something otherwise
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null)
+ {
+ Binding binding = port.getBinding();
+ if (binding != null)
+ {
+ checkNamespace(binding.getQName(), ctx);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null)
+ {
+ PortType pType = binding.getPortType();
+ if (pType != null)
+ {
+ checkNamespace(pType.getQName(), ctx);
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null)
+ {
+ Input input = operation.getInput();
+ if (input != null && input.getMessage() != null)
+ {
+ checkNamespace(input.getMessage().getQName(), ctx);
+ }
+
+ Output output = operation.getOutput();
+ if (output != null && output.getMessage() != null)
+ {
+ checkNamespace(output.getMessage().getQName(), ctx);
+ }
+
+ Map faults = operation.getFaults();
+ for (Iterator iter = faults.values().iterator(); iter.hasNext();)
+ {
+ Fault fault = (Fault) iter.next();
+
+ if (fault.getMessage() != null)
+ {
+ checkNamespace(fault.getMessage().getQName(), ctx);
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ /* REMOVE: This is already done in WSI2417
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx) {
+ if (message != null) {
+ Map parts = message.getParts();
+ for (Iterator iter = parts.values().iterator(); iter.hasNext();) {
+ Part part = (Part) iter.next();
+
+ checkNamespace(part.getElementName(), ctx);
+ checkNamespace(part.getTypeName(), ctx);
+ }
+ }
+ }
+ */
+
+ /* (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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // get list of namespaces imported and defined in the definition
+ List namespaces = this.validator.getWSDLTargetNamespaceList(definition);
+
+ // REMOVE:
+ //Map namespaces = definition.getNamespaces();
+
+ // traverse definition to check namespaces
+ Map params = new HashMap();
+ params.put(NS_LIST_KEY, namespaces);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ // VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition, params);
+
+ if (result.equals(AssertionResult.RESULT_FAILED))
+ {
+ 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/wsdl/BP2417.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2417.java
new file mode 100644
index 000000000..1743d4995
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2417.java
@@ -0,0 +1,160 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Part;
+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.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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+ * BP2417.
+ * <context>For a candidate wsdl:definitions</context>
+ * <assertionDescription>Every QName in the WSDL document and its imports and that
+ * is referring to a schema component, uses the namespace defined in the targetNamespace
+ * attribute on the xs:schema element, or a namespace defined in the namespace attribute
+ * on an xs:import element within the xs:schema element.</assertionDescription>
+ */
+public class BP2417 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2417(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errorList = new ErrorList();
+ private static final String NS_LIST_KEY = "namespaces";
+
+ /**
+ * Checks whether the namespace is defined or imported in the definition.
+ * @param qname
+ * @param ctx
+ */
+ private void checkNamespace(QName qname, WSDLTraversalContext ctx)
+ {
+ if (qname != null)
+ {
+ String namespace = qname.getNamespaceURI();
+
+ if (namespace != null)
+ {
+ List namespaceList = (List) ctx.getParameter(NS_LIST_KEY);
+
+ if ((namespaceList != null) && !namespaceList.contains(namespace))
+ {
+ errorList.add(qname);
+ }
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null)
+ {
+ Map parts = message.getParts();
+
+ for (Iterator iter = parts.values().iterator(); iter.hasNext();)
+ {
+ Part part = (Part) iter.next();
+
+ checkNamespace(part.getElementName(), ctx);
+ checkNamespace(part.getTypeName(), ctx);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.wst.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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ // Get a list of all schema targetNamespaces
+ List tnsList = null;
+ try
+ {
+ if ((tnsList = this.validator.getSchemaNamespaceList(definition)) == null)
+ tnsList = new Vector();
+ }
+
+ catch (WSIException e)
+ {
+ // This exception would indicate that the schema definition had a problem
+ tnsList = new Vector();
+ }
+
+ // Always add XML schema namespace to cover built-in types
+ tnsList.add(WSIConstants.NS_URI_XSD);
+
+ // Traverse definition to check schema namespaces
+ Map params = new HashMap();
+ params.put(NS_LIST_KEY, tnsList);
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitMessage(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition, params);
+
+ // If there were no errors, then the assertion passed
+ if (errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ // Otherwise it failed / create the failure detail using the QNames that were in error
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errorList.toString(), 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/wsdl/BP2700.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2700.java
new file mode 100644
index 000000000..bbf231226
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2700.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.Utils;
+import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
+import org.xml.sax.SAXException;
+
+/**
+ * BP2700.
+ * <context>For a candidate wsdl:definitions element within a WSDL document.</context>
+ * <assertionDescription>The wsdl:definitions is a well-formed XML 1.0 document.</assertionDescription>
+ */
+public class BP2700 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2700(WSDLValidatorImpl 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
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ try
+ {
+ //String wsdlURI = entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI();
+ // TEMP: Need to define a better way to get the WSDL URI
+ String wsdlURI = entryContext.getEntry().getReferenceID();
+ // non-validating parse
+ XMLUtils.parseXMLDocument(wsdlURI);
+ }
+
+ 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/wsdl/BP2701.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2701.java
new file mode 100644
index 000000000..124c1f99a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2701.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2701.
+ * <context>For a candidate wsdl:definitions element within a WSDL document.</context>
+ * <assertionDescription>The wsdl:definitions namespace has value: http://schemas.xmlsoap.org/wsdl/.</assertionDescription>
+ */
+public class BP2701 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2701(WSDLValidatorImpl 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
+ {
+
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+
+ /*
+ if (def != null) {
+ QName qname = def.getQName();
+
+ if (qname != null) {
+ //if (def.getNamespace("").equals(WSIConstants.NS_URI_WSDL) {
+ if (qname.getNamespaceURI().equals(WSIConstants.NS_URI_WSDL)) {
+ result = AssertionResult.RESULT_PASSED;
+ }
+ }
+ }
+ */
+
+ try
+ {
+ String schemaUsed = this.validator.getSchemaUsed(def);
+ if (schemaUsed.equals(WSIConstants.NS_URI_WSDL))
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_FAILED;
+ }
+ }
+
+ catch (AssertionFailException e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ //ADD: failure description?
+ }
+
+ // 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/wsdl/BP2703.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2703.java
new file mode 100644
index 000000000..e23a69c95
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2703.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+
+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.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.xml.sax.SAXException;
+
+
+/**
+ * BP2703.
+ * <context>For a candidate description within a WSDL document, if it uses the WSDL namespace</context>
+ * <assertionDescription>The definition conforms to the WSDL schema located at http://schemas.xmlsoap.org/wsdl/2003-02-11.xsd</assertionDescription>
+ */
+public class BP2703 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2703(WSDLValidatorImpl 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
+ {
+
+ result = AssertionResult.RESULT_PASSED;
+
+ try
+ {
+ Definition def = (Definition) entryContext.getEntry().getEntryDetail();
+
+ if (def == null)
+ {
+ throw new AssertionFailException("Definition null");
+ }
+
+ String wsdlURI = entryContext.getEntry().getReferenceID();
+
+ Map namespaces = def.getNamespaces();
+ for (Iterator iter = namespaces.values().iterator(); iter.hasNext();)
+ {
+ String ns = (String) iter.next();
+
+ if (WSIConstants.NS_URI_WSDL.equalsIgnoreCase(ns))
+ {
+ XMLUtils.parseXMLDocument(wsdlURI, TestUtils.getWSDLSchemaLocation());
+ }
+
+ if (WSIConstants.NS_URI_WSDL_SOAP.equalsIgnoreCase(ns))
+ {
+ XMLUtils.parseXMLDocument(wsdlURI, TestUtils.getWSDLSOAPSchemaLocation());
+ }
+ }
+ }
+
+ 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/wsdl/BP2803.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2803.java
new file mode 100644
index 000000000..a2602a2a8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP2803.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.net.URI;
+
+import javax.wsdl.Import;
+
+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.report.AssertionResult;
+
+
+/**
+ * BP2803
+ * <context>For a candidate wsdl:import element</context>
+ * <assertionDescription>The "namespace" attribute is specified for the wsdl:import element, and the attribute's value is not a relative URI.</assertionDescription>
+ */
+public class BP2803 extends AssertionProcess
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP2803(WSDLValidatorImpl 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
+ {
+
+ // Getting wsdl:import
+ Import im = (Import) entryContext.getEntry().getEntryDetail();
+
+ try
+ {
+ // If there is no the "namespace" attribute in the import,
+ // the assertion is not applicable
+ if (im.getNamespaceURI() == null)
+ {
+ throw new AssertionNotApplicableException();
+ }
+
+ // If a namespace URI is relative or invalid, the assertion failed
+ URI uri = new URI(im.getNamespaceURI());
+ if (!uri.isAbsolute())
+ {
+ throw new AssertionFailException(
+ im.getNamespaceURI() + " is relative URI.");
+ }
+ }
+ catch (AssertionNotApplicableException anae)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ catch (Exception e)
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = validator.createFailureDetail(
+ e.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/wsdl/BP4200.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4200.java
new file mode 100644
index 000000000..f2c73355b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4200.java
@@ -0,0 +1,162 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.Attr;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+
+/**
+ * BP4200.
+ * <context>For a candidate wsdl:definitions that contains a wsdl extension element or attribute from a namespace other than "http://schemas.xmlsoap.org/wsdl/soap/".</context>
+ * <assertionDescription>Contained WSDL extension elements that do not belong to the "http://schemas.xmlsoap.org/wsdl/soap/" namespaces may require out of band negotiation.</assertionDescription>
+*/
+public class BP4200 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+ private ErrorList errorList = new ErrorList();
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4200(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(ExtensibilityElement obj, Object parent,
+ WSDLTraversalContext ctx)
+ {
+ // If a child element of wsdl:types is from a namespace other than
+ // "http://www.w3.org/2001/XMLSchema"
+ if (parent instanceof Types)
+ {
+ //if (!obj.getElementType().getNamespaceURI().equals(
+ // WSIConstants.NS_URI_XSD))
+ //{
+ // Add element name to error list
+ // errorList.add(obj.getElementType());
+ //}
+ }
+ // or any other ext element coming from a namespace other than
+ // "http://schemas.xmlsoap.org/wsdl/soap/"
+ else if (!obj.getElementType().getNamespaceURI().equals(WSIConstants.NS_URI_WSDL_SOAP)
+ && !obj.getElementType().getNamespaceURI().equals(WSIConstants.NS_URI_WSDL))
+ {
+ // Add element name to error list
+ errorList.add(obj.getElementType());
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.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
+ {
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+
+ traversal.visitExtensibilityElement(true);
+ traversal.visitElement(true);
+
+ traversal.ignoreImport();
+ traversal.ignoreReferences();
+ traversal.traverse(definition);
+
+ try
+ {
+ // getting WSDL document.
+ Document doc = XMLUtils.parseXMLDocument(definition.getDocumentBaseURI());
+ if (doc != null)
+ {
+ checkElement(doc.getDocumentElement());
+
+ if (errorList.isEmpty())
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ {
+ failureDetail = validator.createFailureDetail(
+ testAssertion.getDetailDescription() + "\n\n" + errorList.toString(),
+ entryContext);
+ }
+ }
+ }
+ catch (Throwable t)
+ {
+ }
+ // Return assertion result
+ return validator.createAssertionResult(
+ testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Checking on wsdl elements recursively whether they contain extension attributes.
+ * @param elem Element.
+ */
+ private void checkElement(Element elem)
+ {
+ while (elem != null)
+ {
+ String elemNS = elem.getNamespaceURI();
+ NamedNodeMap attrs = elem.getAttributes();
+ if (attrs != null)
+ {
+ for (int i = 0; i < attrs.getLength(); i++)
+ {
+ Attr attr = (Attr) attrs.item(i);
+ String attrNS = attr.getNamespaceURI();
+ if (attrNS != null
+ && !attrNS.equals(WSIConstants.NS_URI_XMLNS)
+ && !attrNS.equals(WSIConstants.NS_URI_WSDL)
+ && !attrNS.equals(WSIConstants.NS_URI_WSDL_SOAP))
+ {
+ errorList.add("Extensibility attribute " + attr.getName()
+ + "for the " + elem.getNodeName() + " element is found.");
+ }
+ }
+ }
+
+ if (!elemNS.equals(WSIConstants.NS_URI_XSD))
+ {
+ checkElement(XMLUtils.getFirstChild(elem));
+ }
+ elem = XMLUtils.getNextSibling(elem);
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4201.java
new file mode 100644
index 000000000..21f131f16
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4201.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.net.URISyntaxException;
+import java.util.Iterator;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Port;
+import javax.wsdl.extensions.soap.SOAPAddress;
+
+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.AssertionProcessVisitor;
+import org.eclipse.wst.wsi.internal.core.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal;
+import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext;
+
+
+/**
+* BP4201.
+* <context>For a candidate wsdl:import element, where the location attribute or the namespace attribute has a value that is a relative URI, or a for soap:address element where the location attribute is a relative URI.</context>
+* <assertionDescription>The use of a relative URI as the value for a wsdl:import location or namespace attribute, or for a soap:address location attribute may require out of band coordination.</assertionDescription>
+*/
+public class BP4201 extends AssertionProcessVisitor
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4201(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+ private ErrorList errorList = new ErrorList();
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Import, Object, WSDLTraversalContext)
+ */
+ public void visit(Import obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if(obj != null)
+ {
+ if(isRelativeURI(obj.getNamespaceURI()) ||
+ isRelativeURI(obj.getLocationURI()))
+ {
+ errorList.add(obj.getNamespaceURI(), obj.getLocationURI());
+ }
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Port, Object, WSDLTraversalContext)
+ */
+ public void visit(Port obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if(obj != null)
+ {
+ Iterator it = obj.getExtensibilityElements().iterator();
+ while (it.hasNext())
+ {
+ Object e = (Object) it.next();
+ // for each SOAPAddress elements check LocationURI
+ if(e instanceof SOAPAddress) {
+ if(isRelativeURI(((SOAPAddress) e).getLocationURI()))
+ {
+ errorList.add(((SOAPAddress) e).getElementType() +
+ ":" + ((SOAPAddress) e).getLocationURI());
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the definition from the entry context
+ Definition definition =
+ (Definition) entryContext.getEntry().getEntryDetail();
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitImport(true);
+ traversal.visitPort(true);
+ traversal.ignoreReferences();
+ traversal.traverse(definition);
+
+ if (errorList.isEmpty())
+ {
+ return validator.createAssertionResult(testAssertion,
+ AssertionResult.RESULT_NOT_APPLICABLE, (String) null);
+ }
+
+ failureDetail = this.validator.createFailureDetail(testAssertion.getFailureMessage() +
+ "\n\n" + errorList.toString(), entryContext);
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+ /**
+ * Returns true if URI is relative
+ * @param s - URI
+ * @return true - if URI is relative, false - in other case
+ */
+ private boolean isRelativeURI(String s)
+ {
+ if(s == null)
+ return false;
+ try
+ {
+ if(new java.net.URI(s).isAbsolute())
+ {
+ return false;
+ }
+ } catch (URISyntaxException e)
+ {
+ 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/wsdl/BP4202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4202.java
new file mode 100644
index 000000000..63791e0f1
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/BP4202.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.schema.XMLSchemaProcessor;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * BP4202.
+ * <context>For an XML schema definition defined in the wsdl:types element, or imported directly or indirectly by a schema definition defined in the wsdl:types element, which contains any schema annotation elements.</context>
+ * <assertionDescription>An XML schema definition defined in the wsdl:types element, or imported directly or indirectly by a schema definition defined in the wsdl:types element, may use schema annotation elements as an extensibility mechanism.</assertionDescription>
+ */
+ public class BP4202 extends AssertionProcessVisitor implements WSITag
+ {
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public BP4202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private static final String ANNOTATION_KEY = "annotation";
+
+ private ErrorList errorList = new ErrorList();
+ private AnnotationProcessor processor;
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(Message, Object, WSDLTraversalContext)
+ */
+ public void visit(ExtensibilityElement obj, Object parent, WSDLTraversalContext ctx)
+ {
+ if((obj != null) && (obj instanceof UnknownExtensibilityElement))
+ {
+ UnknownExtensibilityElement el = (UnknownExtensibilityElement) obj;
+ try {
+ processor.processAllSchema(el.getElement());
+ } catch (WSIException e) {}
+ }
+ }
+
+ /**
+ * (non-Javadoc)
+ * @see org.eclipse.wst.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
+ {
+ result = AssertionResult.RESULT_PASSED;
+
+ // Get the types from the entry context
+ Types types =
+ (Types) entryContext.getEntry().getEntryDetail();
+
+ processor = new AnnotationProcessor(
+ entryContext.getWSDLDocument().getDefinitions().getDocumentBaseURI());
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitExtensibilityElement(true);
+ traversal.ignoreReferences();
+ traversal.traverse(types);
+
+ if (errorList.isEmpty())
+ {
+ return validator.createAssertionResult(testAssertion,
+ AssertionResult.RESULT_NOT_APPLICABLE, (String) null);
+ }
+
+ failureDetail = this.validator.createFailureDetail(testAssertion.getFailureMessage() +
+ "\n\n" + errorList.toString(), entryContext);
+ // Return assertion result
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Class for parse schema and search annotation elements
+ */
+ class AnnotationProcessor extends XMLSchemaProcessor
+ {
+ public AnnotationProcessor(String context)
+ {
+ super(context, false);
+ }
+
+ protected void processSchema(Element element)
+ {
+ checkForAnnotation(element);
+ }
+
+ private void checkForAnnotation(Node node)
+ {
+ if((node.getLocalName() != null) && (node.getLocalName().equals(ANNOTATION_KEY))) {
+ errorList.add(node.toString());
+ }
+ for (int i = 0; i < node.getChildNodes().getLength(); i++)
+ {
+ checkForAnnotation(node.getChildNodes().item(i));
+ }
+ }
+ }
+ } \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2209.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2209.java
new file mode 100644
index 000000000..4c4dd0f25
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2209.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+
+/**
+ * SSBP2209
+ *
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>The wsdl:binding binds every wsdl:part of a wsdl:message in the wsdl:portType to which it refers to one of soapbind:body, soapbind:header, soapbind:fault or soapbind:headerfault.</assertionDescription>
+ */
+public class SSBP2209 extends BP2114
+{
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2209(WSDLValidatorImpl 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/wsdl/SSBP2402.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2402.java
new file mode 100644
index 000000000..9291f3660
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2402.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * SSBP2402
+ */
+public class SSBP2402 extends BP2402
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2402(WSDLValidatorImpl 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/wsdl/SSBP2403.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2403.java
new file mode 100644
index 000000000..041320f33
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/SSBP2403.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.XMLTraversal;
+import org.w3c.dom.Attr;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+
+/**
+ * SSBP2403.
+ * <context>For a candidate wsdl:binding element</context>
+ * <assertionDescription>Descendant elements and attributes in the wsdl:binding are not from the namespaces for the WSDL MIME, HTTP GET/POST or DIME binding extensions.</assertionDescription>
+ */
+public class SSBP2403 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public SSBP2403(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+
+ private ErrorList errors = new ErrorList();
+
+ /**
+ * Returns true if the the namespace specifies any WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ * @param namespace a namespace.
+ * @return true if the the namespace specifies any WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ */
+ private boolean isNonConformantBindingExtension(String namespace)
+ {
+ boolean result = false;
+ if (namespace != null)
+ {
+ if (namespace.equals(WSIConstants.NS_NAME_WSDL_MIME)
+ || namespace.equals(WSIConstants.NS_NAME_WSDL_HTTP)
+ || namespace.equals(WSIConstants.NS_NAME_WSDL_DIME))
+ result = true;
+ }
+ return result;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.ExtensibilityElement, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ ExtensibilityElement exel,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (isNonConformantBindingExtension(exel
+ .getElementType()
+ .getNamespaceURI()))
+ errors.add(exel.getElementType());
+ else
+ {
+ // extensibility element is ok, check the descendants
+ if (exel instanceof UnknownExtensibilityElement)
+ {
+ Element el = ((UnknownExtensibilityElement) exel).getElement();
+
+ // traverse all of the descendants and check for non compliant binding extensions
+ XMLTraversalCheckingExtensions traversal =
+ new XMLTraversalCheckingExtensions();
+ traversal.visit(el);
+ }
+ }
+ }
+
+ /* (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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ traversal.setVisitor(this);
+ traversal.visitElement(true);
+ traversal.visitExtensibilityElement(true);
+
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Binding) entryContext.getEntry().getEntryDetail());
+
+ if (!errors.isEmpty())
+ {
+ result = AssertionResult.RESULT_FAILED;
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ }
+
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+
+ /**
+ * A specialized XMLTraversal class to check if the wsdl:binding element has any
+ * descendant elements/attributes from the namespaces for the WSDL MIME,
+ * HTTP GET/POST or DIME binding extensions.
+ */
+ private class XMLTraversalCheckingExtensions extends XMLTraversal
+ {
+ boolean nonConformantExtensionFound = false;
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLTraversal#action(org.w3c.dom.Node)
+ */
+ public boolean action(Node n)
+ {
+ return !nonConformantExtensionFound;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLVisitor#visit(org.w3c.dom.Attr)
+ */
+ public void visit(Attr node)
+ {
+ if (action(node))
+ {
+ if (isNonConformantBindingExtension(node.getNamespaceURI()))
+ {
+ errors.add(node.getName());
+ nonConformantExtensionFound = true;
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.xml.XMLVisitor#visit(org.w3c.dom.Element)
+ */
+ public void visit(Element node)
+ {
+ if (action(node))
+ {
+ if (isNonConformantBindingExtension(node.getNamespaceURI()))
+ {
+ errors.add(node.getNodeName());
+ nonConformantExtensionFound = true;
+ }
+ else
+ {
+ // element is compliant, check attributes and descendants
+ visit(node.getAttributes());
+ for (Node n = node.getFirstChild();
+ n != null;
+ n = n.getNextSibling())
+ {
+ doVisit(n);
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSDLValidatorImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSDLValidatorImpl.java
new file mode 100644
index 000000000..0ecafd75f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSDLValidatorImpl.java
@@ -0,0 +1,2314 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Vector;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.ExtensibilityElement;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPFault;
+import javax.wsdl.extensions.soap.SOAPHeader;
+import javax.wsdl.extensions.soap.SOAPHeaderFault;
+import javax.wsdl.extensions.soap.SOAPOperation;
+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.WSIRuntimeException;
+import org.eclipse.wst.wsi.internal.core.analyzer.AnalyzerContext;
+import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException;
+import org.eclipse.wst.wsi.internal.core.analyzer.CandidateInfo;
+import org.eclipse.wst.wsi.internal.core.analyzer.ServiceReference;
+import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement;
+import org.eclipse.wst.wsi.internal.core.profile.ProfileArtifact;
+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.WSDLValidator;
+import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseValidatorImpl;
+import org.eclipse.wst.wsi.internal.core.report.Entry;
+import org.eclipse.wst.wsi.internal.core.report.EntryContainer;
+import org.eclipse.wst.wsi.internal.core.report.FailureDetail;
+import org.eclipse.wst.wsi.internal.core.report.ReportArtifact;
+import org.eclipse.wst.wsi.internal.core.report.Reporter;
+import org.eclipse.wst.wsi.internal.core.util.EntryType;
+import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument;
+import org.eclipse.wst.wsi.internal.core.wsdl.WSDLElementList;
+import org.eclipse.wst.wsi.internal.core.wsdl.WSDLUtils;
+import org.eclipse.wst.wsi.internal.core.xml.dom.ElementLocation;
+import org.eclipse.wst.wsi.internal.core.xml.schema.TargetNamespaceProcessor;
+import org.eclipse.wst.wsi.internal.core.xml.schema.XMLSchemaValidator;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+/**
+ * The WSDL validator will verify that the WSDL and associated XML schema definitions
+ * are in conformance with the profile.
+ *
+ * @version 1.0.1
+ * @author Peter Brittenham (peterbr@us.ibm.com)
+ * @author Graham Turrell (gturrell@uk.ibm.com)
+ */
+public class WSDLValidatorImpl
+ extends BaseValidatorImpl
+ implements WSDLValidator
+{
+ /**
+ * WSDL URL.
+ */
+ protected String wsdlURL;
+
+ /**
+ * WSDL document.
+ */
+ protected WSDLDocument wsdlDocument = null;
+
+ /**
+ * Entry container map.
+ */
+ protected HashMap containerMap = new HashMap();
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.WSDLValidator#init(org.eclipse.wst.wsi.internal.core.analyzer.AnalyzerContext, org.wsi.test.profile.ProfileArtifact, org.wsi.test.report.ReportArtifact, java.lang.String, org.wsi.wsdl.WSDLDocument, org.wsi.test.report.Reporter)
+ */
+ public void init(
+ AnalyzerContext analyzerContext,
+ ProfileArtifact profileArtifact,
+ ReportArtifact reportArtifact,
+ String wsdlURL,
+ WSDLDocument wsdlDocument,
+ Reporter reporter)
+ throws WSIException
+ {
+ // BaseValidatorImpl
+ super.init(analyzerContext, profileArtifact, reportArtifact, reporter);
+ this.wsdlDocument = wsdlDocument;
+ if (wsdlDocument != null)
+ this.wsdlURL = wsdlDocument.getLocation();
+
+ if (wsdlURL != null)
+ this.wsdlURL = wsdlURL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.WSDLValidator#validate()
+ */
+ public WSDLDocument validate() throws WSIException
+ {
+ //WSDLDocument wsdlDocument = null;
+ Service service = null;
+ Port port = null;
+ Binding binding = null;
+ PortType portType = null;
+ Operation operation = null;
+ Message message = null;
+
+ // it depricated after refactoring
+ // now the inner classes moved out from validator
+ //String classPrefix = this.getClass().getName() + "$";
+ String classPrefix = this.getClass().getPackage().getName()+".";
+
+ try
+ {
+ // Validate the WSDL service description
+ if (this.wsdlDocument == null)
+ this.wsdlDocument = new WSDLDocument(wsdlURL);
+ }
+
+ catch (Exception e)
+ {
+ // ADD: Certain exceptions should result in validation errors
+
+ throw new WSIException(e.getMessage(), e);
+ }
+
+ // Get the definition element
+ Definition definition = wsdlDocument.getDefinitions();
+
+ // Get service reference from analyzer context
+ ServiceReference serviceReference = analyzerContext.getServiceReference();
+
+ // Create normalized data about the service under test.
+ CandidateInfo candidate = new CandidateInfo(serviceReference, wsdlDocument);
+
+ analyzerContext.setCandidateInfo(candidate);
+
+ // Set prereq type to entry container
+ reporter.setPrereqType(Reporter.PREREQ_TYPE_ENTRY_CONTAINER);
+
+ // always process Import, Definitions & Types assertions
+ // TEMP:
+ processDefinitionAssertions(classPrefix, candidate);
+ processTypesAssertions(classPrefix, candidate);
+ processImportAssertions(classPrefix, candidate);
+
+ // Process the element hierarchy in the WSDL document starting with the one that was specified
+ // FIX: Element finding already completed by CandidateInfo constructor - so use that rather than retest here
+
+ // ---------------------------
+ // wsdl:port
+ // ---------------------------
+ if (serviceReference.getWSDLElement().isPort())
+ {
+ // Find the service element
+ if ((service =
+ definition.getService(
+ serviceReference.getWSDLElement().getParentElementQName()))
+ == null)
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL service: "
+ + serviceReference.getWSDLElement().getParentElementName());
+ }
+
+ // Find the port element
+ if ((port = service.getPort(serviceReference.getWSDLElement().getName()))
+ == null)
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL port: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // TEMP: Remove until there are port test assertions
+ //processPortAssertions(port, serviceReference, classPrefix, wsdlDocument);
+
+ // Next, process the binding
+ if (((binding = port.getBinding()) == null) || (binding.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL binding for port: " + port.getName());
+ // Set missingInput for all binding, portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processBindingAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Next, process the portType
+ if (((portType = binding.getPortType()) == null)
+ || (portType.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL portType for binding: " + binding.getQName().getLocalPart());
+ // Set missingInput for all portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processMessageAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+
+ }
+
+ // ---------------------------
+ // wsdl:binding
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isBinding())
+ {
+ WSDLElement wsdlElement = serviceReference.getWSDLElement();
+ // Find the binding element
+ if (wsdlElement.getQName() != null
+ && wsdlElement.getQName().getLocalPart() != null
+ && wsdlElement.getQName().getLocalPart().length() > 0)
+ {
+ if (((binding =
+ definition.getBinding(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (binding.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL binding: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ processBindingAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ binding,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Next, process the portType
+ if (((portType = binding.getPortType()) == null)
+ || (portType.isUndefined()))
+ {
+ //throw new WSIRuntimeException("Could not locate WSDL PortType for Binding: " + binding.getQName().getLocalPart());
+
+ // Set missingInput for all portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Process each message within each operation of the portType associated with the binding
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+
+ // There was a problem with the binding element specification. This can
+ // happen when a UDDI tModel did not have a valid binding reference.
+ else
+ {
+ // Set missingInput for all binding, portType, operation and message test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+ }
+
+ // ---------------------------
+ // wsdl:portType
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isPortType())
+ {
+ // Find the PortType element
+ if (((portType =
+ definition.getPortType(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (portType.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL PortType: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // Set missingInput for all binding test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+
+ processPortTypeAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processOperationAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+
+ // Process each message within each operation of the portType
+ processMessageAssertions(
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ // ---------------------------
+ // wsdl:operation
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isOperation())
+ {
+ // Find the operation
+ // get portType from config parent element
+ if (((portType =
+ definition.getPortType(
+ serviceReference.getWSDLElement().getParentElementQName()))
+ == null)
+ || (portType.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL portType: "
+ + serviceReference.getWSDLElement().getParentElementQName());
+ }
+
+ if (((operation =
+ getOperationFromPortType(
+ portType,
+ serviceReference.getWSDLElement().getName()))
+ == null)
+ || (operation.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL Operation: "
+ + serviceReference.getWSDLElement().getName()
+ + "in portType: "
+ + portType.getQName());
+ }
+
+ // Set missingInput for all binding and portType test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+
+ processOperationAssertions(
+ operation,
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ processMessageAssertions(
+ operation,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ // ---------------------------
+ // wsdl:message
+ // ---------------------------
+ else if (serviceReference.getWSDLElement().isMessage())
+ {
+ // Find the message
+ if (((message =
+ definition.getMessage(serviceReference.getWSDLElement().getQName()))
+ == null)
+ || (message.isUndefined()))
+ {
+ throw new WSIRuntimeException(
+ "Could not locate WSDL Message: "
+ + serviceReference.getWSDLElement().getName());
+ }
+
+ // Set missingInput for all binding, portType, and operation test assertions
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+
+ processMessageAssertions(
+ message,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+
+ else
+ {
+ throw new WSIRuntimeException(
+ "The following WSDL type is not supported: "
+ + serviceReference.getWSDLElement().getType());
+ }
+
+ // Cleanup
+ cleanup();
+
+ // Return WSDL document
+ return this.wsdlDocument;
+ }
+
+ /**
+ * Get entry container using the filename for WSDL document.
+ * @param filename a file name.
+ * @return entry container using the filename for WSDL document.
+ */
+ protected EntryContainer getEntryContainer(String filename)
+ {
+ EntryContainer entryContainer = null;
+
+ // If the entry container already exists, then use it
+ if ((entryContainer = (EntryContainer) containerMap.get(filename)) == null)
+ {
+ // Create new entry container
+ entryContainer = this.reporter.createEntryContainer();
+
+ // Set container id using the filename for the WSDL document
+ entryContainer.setId(filename);
+
+ // Put the new entry container into the container map
+ containerMap.put(filename, entryContainer);
+ }
+
+ return entryContainer;
+ }
+
+ /**
+ * Get operation from port type.
+ * @param portType port type.
+ * @param operationName operation name.
+ * @return operation from port type.
+ */
+ protected Operation getOperationFromPortType(
+ PortType portType,
+ String operationName)
+ {
+ // FIX: wsdl4j available method call below implies that only
+ // name+inputname+outputname uniquely defines operation
+ // Use this instead for now: - get the first operation we find...
+ Operation op = null;
+ if (portType.getOperations() != null)
+ {
+ Iterator opIt = portType.getOperations().iterator();
+
+ while (opIt.hasNext())
+ {
+ op = (Operation) opIt.next();
+ if (operationName.equals(op.getName()))
+ {
+ return op;
+ }
+ }
+ }
+
+ return null; // no matching operation found
+ }
+
+ /**
+ * Process definition assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected void processDefinitionAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+
+ Entry entry = null;
+
+ Definition[] wsdlDefinitions = candidate.getDefinitions();
+
+ for (int i = 0; i < wsdlDefinitions.length; i++)
+ {
+ Definition definition = wsdlDefinitions[i];
+ if (definition == null)
+ continue;
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_DEFINITIONS));
+ entry.setReferenceID(definition.getDocumentBaseURI());
+ entry.setEntryDetail(definition);
+
+ // Set entry container
+ entry.setEntryContainer(
+ getEntryContainer(definition.getDocumentBaseURI()));
+
+ // Process all of the definition related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ // ADD: need to use here the specific document corresponding to the definition??
+
+ }
+ }
+
+ /**
+ * Process types assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problem occurs during processing
+ * type assertions.
+ */
+ protected void processTypesAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+ Entry entry = null;
+
+ Types[] wsdlTypes = candidate.getTypes();
+ Definition[] wsdlDefinitions = candidate.getDefinitions();
+
+ // If there are no types elements, then set all results to missingInput
+ if (wsdlTypes == null || wsdlTypes.length == 0)
+ {
+ // Set missingInput for all test assertions with this entry type
+ setMissingInput(EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_TYPES));
+ }
+
+ else
+ {
+ for (int i = 0; i < wsdlTypes.length; i++)
+ {
+ Types types = wsdlTypes[i];
+ if (types == null)
+ {
+ // no Types element in i-th document
+ continue;
+ }
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_TYPES));
+ entry.setReferenceID(
+ candidate.getDefinition(types).getDocumentBaseURI() + "-Types");
+ entry.setEntryDetail(types);
+
+ // Set entry container
+ entry.setEntryContainer(
+ getEntryContainer(wsdlDefinitions[i].getDocumentBaseURI()));
+
+ // Process all of the Types related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ }
+ }
+ }
+
+ /**
+ * Process import assertions.
+ * @param classPrefix class prefix.
+ * @param candidate candidate.
+ * @throws WSIException if problem occurs during processing
+ * import assertions.
+ */
+ protected void processImportAssertions(
+ String classPrefix,
+ CandidateInfo candidate)
+ throws WSIException
+ {
+
+ Entry entry = null;
+
+ Import[] wsdlImports = candidate.getImports();
+
+ // If there are no import elements, then set all results to missingInput
+ if (wsdlImports == null || wsdlImports.length == 0)
+ {
+ // Set missingInput for all test assertions with this entry type
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_IMPORT));
+ }
+
+ else
+ {
+ for (int i = 0; i < wsdlImports.length; i++)
+ {
+ Import wsdlImport = wsdlImports[i];
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_IMPORT));
+ entry.setReferenceID(wsdlImport.getNamespaceURI());
+ entry.setEntryDetail(wsdlImport);
+
+ // Set entry container
+ entry.setEntryContainer(getEntryContainer(wsdlImport.getLocationURI()));
+
+ // Process all of the import related test assertions
+ processAssertions(
+ classPrefix,
+ new EntryContext(entry, candidate.getWsdlDocument()));
+ // ADD: need to use here the specific document corresponding to the import!!
+ }
+ }
+ }
+
+ /**
+ * Process port assertions.
+ * @param port a port.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * port assertions.
+ */
+ protected void processPortAssertions(
+ Port port,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ Entry entry = null;
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORT));
+ entry.setReferenceID(port.getName());
+ entry.setParentElementName(
+ serviceReference.getWSDLElement().getParentElementName());
+ entry.setEntryDetail(port);
+
+ // Process assertions for this artifact against the target context
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process binding assertions.
+ * @param binding binding.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * binding assertions.
+ */
+ protected void processBindingAssertions(
+ Binding binding,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ Entry entry = null;
+ QName bindingQName = binding.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_BINDING));
+ entry.setReferenceID(bindingQName.toString());
+ entry.setEntryDetail(binding);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(binding);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process binding test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process port type assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * port type assertions.
+ */
+ protected void processPortTypeAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ Entry entry = null;
+ QName portTypeQName = portType.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_PORTTYPE));
+ entry.setReferenceID(portTypeQName.toString());
+ entry.setEntryDetail(portType);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(portType);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process operation assertions.
+ * @param operation an operation.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * operation assertions.
+ */
+ protected void processOperationAssertions(
+ Operation operation,
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ // qualify operation with service location from config.
+ Entry entry = null;
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ entry.setReferenceID(operation.getName());
+ entry.setParentElementName(portType.getQName().getLocalPart());
+ entry.setEntryDetail(operation);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(portType);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process operation assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * operation assertions.
+ */
+ protected void processOperationAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ // For each operation,
+ if (portType.getOperations() == null)
+ {
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ }
+
+ else
+ {
+ Operation operation;
+ Iterator opIt = portType.getOperations().iterator();
+ while (opIt.hasNext())
+ {
+ operation = (Operation) opIt.next();
+ if (operation == null || operation.isUndefined())
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_OPERATION));
+ else
+ processOperationAssertions(
+ operation,
+ portType,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param message a message.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Message message,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ Entry entry = null;
+ QName messageQName = message.getQName();
+
+ // Create entry
+ entry = this.reporter.getReport().createEntry();
+ entry.setEntryType(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ entry.setReferenceID(messageQName.toString());
+ entry.setEntryDetail(message);
+
+ // Set entry container
+ Definition definition =
+ analyzerContext.getCandidateInfo().getDefinition(message);
+ entry.setEntryContainer(
+ getEntryContainer(
+ (definition == null ? null : definition.getDocumentBaseURI())));
+
+ // Process binding test assertions
+ processAssertions(classPrefix, new EntryContext(entry, wsdlDocument));
+ }
+
+ /**
+ * Process message assertions.
+ * @param binding a binding.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Binding binding,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+ HashSet messageSet;
+
+ if (binding.getBindingOperations() != null)
+ { // can do nothing if have no operations defined
+ messageSet =
+ WSDLUtils.findMessages(wsdlDocument.getDefinitions(), binding);
+
+ // Process any messages that were found
+ if (messageSet.size() > 0)
+ {
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ Message message = (Message) messageIt.next();
+ if (!message.isUndefined())
+ processMessageAssertions(
+ message,
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param portType port type.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ PortType portType,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ HashSet messageSet = new HashSet();
+
+ if (portType.getOperations() != null)
+ {
+ // can do nothing if have no operations defined
+
+ Iterator opIt = portType.getOperations().iterator();
+
+ while (opIt.hasNext())
+ {
+ Operation op = (Operation) opIt.next();
+
+ // Since there is no guarantee that we have both and input and output message,
+ // check for its existence before adding it
+ if (op.getInput() != null && !op.getInput().getMessage().isUndefined())
+ messageSet.add(op.getInput().getMessage());
+
+ if (op.getOutput() != null
+ && !op.getOutput().getMessage().isUndefined())
+ messageSet.add(op.getOutput().getMessage());
+
+ // also messages from any Faults defined within the operation
+ if (op.getFaults() != null)
+ {
+ Iterator faultIt = op.getFaults().values().iterator();
+ Message message;
+ while (faultIt.hasNext())
+ {
+ message = ((Fault) faultIt.next()).getMessage();
+ if (!message.isUndefined())
+ messageSet.add(message);
+ }
+ }
+ }
+
+ if (messageSet.size() == 0)
+ {
+ // Set all message test assertion results to missingInput
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ // now step through each derived Message
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ processMessageAssertions(
+ (Message) (messageIt.next()),
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+ }
+
+ /**
+ * Process message assertions.
+ * @param op - operation.
+ * @param serviceReference service reference.
+ * @param classPrefix class prefix.
+ * @param wsdlDocument WSDL document.
+ * @throws WSIException if problem occurs during processing
+ * message assertions.
+ */
+ protected void processMessageAssertions(
+ Operation op,
+ ServiceReference serviceReference,
+ String classPrefix,
+ WSDLDocument wsdlDocument)
+ throws WSIException
+ {
+
+ HashSet messageSet = new HashSet();
+ if (op.getInput() != null && !op.getInput().getMessage().isUndefined())
+ messageSet.add(op.getInput().getMessage());
+
+ if (op.getOutput() != null && !op.getOutput().getMessage().isUndefined())
+ messageSet.add(op.getOutput().getMessage());
+
+ // also messages from any Faults defined within the operation
+ Iterator faultIt = op.getFaults().values().iterator();
+ Message message;
+ while (faultIt.hasNext())
+ {
+ message = ((Fault) faultIt.next()).getMessage();
+ if (!message.isUndefined())
+ messageSet.add(message);
+ }
+
+ if (messageSet.size() == 0)
+ {
+ // Set all message test assertion results to missingInput
+ setMissingInput(
+ EntryType.getEntryType(EntryType.TYPE_DESCRIPTION_MESSAGE));
+ }
+
+ else
+ {
+ // now step through each derived Message
+ Iterator messageIt = messageSet.iterator();
+ while (messageIt.hasNext())
+ {
+ processMessageAssertions(
+ (Message) (messageIt.next()),
+ serviceReference,
+ classPrefix,
+ wsdlDocument);
+ }
+ }
+ }
+
+ /* (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 targetContext)
+ {
+ boolean match = false;
+
+ // If the test assertion entry type matches the target context entry type, then contine
+ if (testAssertion
+ .getEntryTypeName()
+ .equals(targetContext.getEntry().getEntryType().getTypeName()))
+ {
+ match = true;
+ }
+
+ return match;
+ }
+
+ /* (non-Javadoc)
+ * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isNotApplicable(org.wsi.test.profile.TestAssertion)
+ */
+ protected boolean isNotApplicable(TestAssertion testAssertion)
+ {
+ boolean notApplicable = false;
+
+ // ADD:
+
+ return notApplicable;
+ }
+
+ /**
+ * Method getSoapFaults.
+ *
+ * @param inBinding in binding.
+ * @return soap faults.
+ * @throws WSIException if problems occur while processing binding faults.
+ */
+ protected SOAPFault[] getSoapFaults(Binding inBinding) throws WSIException
+ {
+
+ Vector soapFaults = new Vector();
+
+ // Go through each bindingFault one at a time
+ BindingFault[] bindingFaults = getAllBindingFaults(inBinding);
+ for (int fault = 0; fault < bindingFaults.length; fault++)
+ {
+ SOAPFault soapFault = getSoapFault(bindingFaults[fault]);
+ if (soapFault != null)
+ {
+ soapFaults.add(soapFault);
+ }
+ }
+
+ SOAPFault[] soapFaultArray = new SOAPFault[soapFaults.size()];
+ soapFaults.copyInto(soapFaultArray);
+
+ return soapFaultArray;
+ }
+
+ /**
+ * Method getAllBindingFaults.
+ *
+ * @param inBinding binding.
+ * @return all binding faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected BindingFault[] getAllBindingFaults(Binding inBinding)
+ throws WSIException
+ {
+
+ Vector faults = new Vector();
+
+ try
+ {
+
+ Iterator bindingOperations = inBinding.getBindingOperations().iterator();
+
+ while (bindingOperations.hasNext())
+ {
+
+ try
+ {
+ BindingOperation bo = (BindingOperation) bindingOperations.next();
+ Iterator bindingFaults = bo.getBindingFaults().values().iterator();
+ while (bindingFaults.hasNext())
+ {
+
+ faults.add((BindingFault) bindingFaults.next());
+ }
+ }
+ catch (NullPointerException e)
+ {
+
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ // no binding operations in this binding - ignore & continue
+ }
+
+ BindingFault[] faultArray = new BindingFault[faults.size()];
+ faults.copyInto(faultArray);
+
+ return faultArray;
+ }
+
+ /**
+ * Method getWSDLFaults.
+ *
+ * @param bindingFault a binding fault.
+ * @return WSDL faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPFault getSoapFault(BindingFault bindingFault)
+ throws WSIException
+ {
+
+ SOAPFault soapFault = null;
+ try
+ {
+ Iterator faultExtensibles =
+ bindingFault.getExtensibilityElements().iterator();
+
+ while (faultExtensibles.hasNext() && soapFault == null)
+ {
+ try
+ {
+ soapFault = (SOAPFault) faultExtensibles.next();
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Fault elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ }
+
+ return soapFault;
+ }
+
+ /**
+ * Method getSoapHeader.
+ *
+ * @param inBinding a binding.
+ * @return SOAP headers.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPHeader[] getSoapHeaders(Binding inBinding) throws WSIException
+ {
+ // Get all bindings
+ Binding[] bindingList = new Binding[1];
+ bindingList[0] = inBinding;
+
+ Vector soapHeaderList = new Vector();
+
+ // Go through each binding one at a time
+ for (int binding = 0; binding < bindingList.length; binding++)
+ {
+ try
+ {
+ // get the list of binding Operations
+ BindingOperation[] bindingOperations =
+ (BindingOperation[]) bindingList[binding]
+ .getBindingOperations()
+ .toArray(
+ new BindingOperation[0]);
+
+ // get references to the extensible elements within the <input> and <output> elements of this binding <operation>.
+ for (int bo = 0; bo < bindingOperations.length; bo++)
+ {
+
+ // Iterate over all input/output extensibles, looking for <SOAP:Body> elements.
+ try
+ {
+ BindingInput bindingInput = bindingOperations[bo].getBindingInput();
+ BindingOutput bindingOutput =
+ bindingOperations[bo].getBindingOutput();
+
+ Iterator extElements =
+ bindingInput.getExtensibilityElements().iterator();
+ while (extElements.hasNext())
+ {
+ try
+ {
+ soapHeaderList.add((SOAPHeader) extElements.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Header.
+ }
+ }
+
+ extElements = bindingOutput.getExtensibilityElements().iterator();
+ while (extElements.hasNext())
+ {
+ try
+ {
+ soapHeaderList.add((SOAPHeader) extElements.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Header.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <input> or <output> - ignore : not checking this here.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ {
+ // no binding operations in this binding - ignore & continue
+ }
+ }
+
+ SOAPHeader[] soapHeaderArray = new SOAPHeader[soapHeaderList.size()];
+ soapHeaderList.copyInto(soapHeaderArray);
+
+ return soapHeaderArray;
+ }
+
+ /**
+ * Method getSoapHeaderFaults.
+ *
+ * WSDLDocument getter method - maybe better off in class WSDLDocument...
+ *
+ * @param inBinding a binding.
+ * @return SOAP header faults.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPHeaderFault[] getSoapHeaderFaults(Binding inBinding)
+ throws WSIException
+ {
+ Vector soapHeaderFaultList = new Vector();
+
+ // Get the list of SOAP headers
+ SOAPHeader[] soapHeaderArray = getSoapHeaders(inBinding);
+
+ // Go through the list and get the header faults
+ List list = null;
+ for (int header = 0; header < soapHeaderArray.length; header++)
+ {
+ // Get list for this header
+ if ((list = soapHeaderArray[header].getSOAPHeaderFaults()) != null)
+ {
+ // Add to primary list
+ soapHeaderFaultList.addAll(list);
+ }
+ }
+
+ SOAPHeaderFault[] soapHeaderFaultArray =
+ new SOAPHeaderFault[soapHeaderFaultList.size()];
+ soapHeaderFaultList.copyInto(soapHeaderFaultArray);
+
+ return soapHeaderFaultArray;
+ }
+
+ /**
+ * Method getSoapBodies.
+ *
+ * WSDLDocument getter method - maybe better off in class WSDLDocument...
+ *
+ * @param inBinding a binding.
+ * @return SOAP bodies.
+ * @throws WSIException if if problems occur during processing.
+ */
+ protected SOAPBody[] getSoapBodies(Binding inBinding) throws WSIException
+ {
+ // REMOVE: Get all bindings
+ //Binding[] bindingList = wsdlDocument.getBindings();
+ Binding[] bindingList = new Binding[1];
+ bindingList[0] = inBinding;
+
+ Vector soapBodies = new Vector();
+
+ // Go through each binding one at a time
+ for (int binding = 0; binding < bindingList.length; binding++)
+ {
+ // get the list of binding Operations
+ BindingOperation[] bindingOperations =
+ (BindingOperation[]) bindingList[binding]
+ .getBindingOperations()
+ .toArray(
+ new BindingOperation[0]);
+
+ // get references to the extensible elements within the <input> and <output> elements of this binding <operation>.
+ for (int bo = 0; bo < bindingOperations.length; bo++)
+ {
+
+ // Iterate over all input/output extensibles, looking for <SOAP:Body> elements.
+ try
+ {
+ Iterator inputExtensibles =
+ bindingOperations[bo]
+ .getBindingInput()
+ .getExtensibilityElements()
+ .iterator();
+ while (inputExtensibles.hasNext())
+ {
+ try
+ {
+ soapBodies.add((SOAPBody) inputExtensibles.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Body elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <input> - ignore : not checking this here.
+ }
+
+ try
+ {
+ Iterator outputExtensibles =
+ bindingOperations[bo]
+ .getBindingOutput()
+ .getExtensibilityElements()
+ .iterator();
+ while (outputExtensibles.hasNext())
+ {
+ try
+ {
+ soapBodies.add((SOAPBody) outputExtensibles.next());
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Body elements.
+ }
+ }
+ }
+ catch (NullPointerException e)
+ { // no extensibility elements for <output>.
+ }
+ }
+ }
+
+ SOAPBody[] soapBodyArray = new SOAPBody[soapBodies.size()];
+ soapBodies.copyInto(soapBodyArray);
+
+ return soapBodyArray;
+ }
+
+ /**
+ * Method getSoapBody.
+ *
+ * @param bindingInput a BindingInput object.
+ * @return body.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPBody getSoapBody(BindingInput bindingInput) throws WSIException
+ {
+
+ SOAPBody soapBody = null;
+
+ Iterator extensibles = bindingInput.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPBody)
+ {
+ soapBody = (SOAPBody) extensible;
+ break;
+ }
+ }
+ return soapBody;
+ }
+
+ /**
+ * Method getSoapBody.
+ *
+ * @param bindingOutput a BindingOutput object.
+ * @return SOAP body.
+ * @throws WSIException if problems occur during processing.
+ */
+ protected SOAPBody getSoapBody(BindingOutput bindingOutput)
+ throws WSIException
+ {
+
+ SOAPBody soapBody = null;
+
+ Iterator extensibles = bindingOutput.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPBody)
+ {
+ soapBody = (SOAPBody) extensible;
+ break;
+ }
+ }
+ return soapBody;
+ }
+
+ /**
+ * Get schema used.
+ * @param def definition.
+ * @return Schema used.
+ * @throws AssertionFailException if problem getting WSDL defintions
+ * namespace.
+ */
+ protected String getSchemaUsed(Definition def) throws AssertionFailException
+ {
+ String schemaUsed = "";
+
+ try
+ {
+ // Need to read the file directly, since WSDL4J always puts in the default WSDL namespace
+ Document document = parseXMLDocumentURL(def.getDocumentBaseURI(), null);
+
+ if (document != null)
+ {
+ // Get the root element
+ Element element = document.getDocumentElement();
+
+ // Get the namespace for this element
+ if (element != null)
+ schemaUsed = element.getNamespaceURI();
+ }
+ }
+
+ catch (WSIException we)
+ {
+ throw new AssertionFailException("problem getting WSDL defintions namespace");
+ }
+
+ /*
+ // Get the default namespace
+ String schemaUsed = def.getNamespace("");
+
+ // If the default was set, then process it to get the namespace
+ if (schemaUsed == null) {
+ // do it the hard way (still better than another DOM parse)...
+ //WSDLWriter w = new WSDLWriterImpl();
+ try {
+ WSDLWriter w = WSDLFactory.newInstance().newWSDLWriter();
+ Document doc = w.getDocument(def);
+ Element e = doc.getDocumentElement();
+ schemaUsed = e.getNamespaceURI();
+ }
+ catch (NullPointerException e) {
+ throw new AssertionFailException("problem getting WSDL defintions namespace");
+ }
+ catch (WSDLException e) {
+ throw new AssertionFailException("problem getting document defintion");
+ }
+ }
+ */
+
+ return schemaUsed;
+ }
+
+ /**
+ * Method getSoapBinding.
+ *
+ * Get the SOAP binding for a Binding.
+ *
+ * @param binding a binding.
+ * @return a SOAP binding.
+ * @throws WSIException if problems occur during processing.
+ */
+ public static SOAPBinding getSoapBinding(Binding binding) throws WSIException
+ {
+ SOAPBinding soapBinding = null;
+
+ // Get the list of extensibility elements
+ List exElements = binding.getExtensibilityElements();
+ if (exElements != null)
+ {
+ Iterator iterator = binding.getExtensibilityElements().iterator();
+
+ // Check for <soap:binding> element
+ while ((iterator.hasNext()) && (soapBinding == null))
+ {
+ try
+ {
+ soapBinding = (SOAPBinding) iterator.next();
+ }
+ catch (ClassCastException e)
+ { // ignore everything but SOAP Binding element
+ }
+ }
+ }
+
+ return soapBinding;
+ }
+
+ /**
+ * Create XML schema validator. This is done here because some compilers do not allow
+ * the documentList field to be accessed from within an inner class.
+ * @param documentBaseURI the base URL.
+ * @return newly created XML schema validator.
+ */
+ protected XMLSchemaValidator createXMLSchemaValidator(String documentBaseURI)
+ {
+ // Create XML schema validator
+ return new XMLSchemaValidator(documentBaseURI);
+ }
+
+ /**
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param definition a Definition object.
+ * @return a list of schema target namespaces.
+ * @throws WSIException if problem during processing method.
+ */
+ protected List getSchemaTargetNamespaceList(Definition definition)
+ throws WSIException
+ {
+ List list = null, nextList = null;
+
+ // Get list of extension elements within the types element
+ Types types = null;
+ if ((types = definition.getTypes()) != null)
+ {
+ Iterator iterator = types.getExtensibilityElements().iterator();
+
+ ExtensibilityElement extElement = null;
+ while (iterator.hasNext())
+ {
+ // Get next ext. element
+ extElement = (ExtensibilityElement) iterator.next();
+ // If this is an unknown ext. element, then see if it is a schema element
+ TargetNamespaceProcessor tnsProcessor = null;
+ if (extElement instanceof UnknownExtensibilityElement)
+ {
+ tnsProcessor = new TargetNamespaceProcessor(definition.getDocumentBaseURI());
+
+
+ if ((nextList =
+ tnsProcessor.processAllSchema(
+ ((UnknownExtensibilityElement) extElement).getElement()))
+ != null)
+ if (list == null)
+ list = new Vector();
+ list.addAll(nextList);
+ }
+ }
+ }
+
+ return list;
+ }
+ /**
+ * Search xsd schema or xsd import from node. If node is xsd import it's loading schema.
+ * @param definition a Definition object.
+ * @return a list of schema target namespaces.
+ * @throws WSIException if problem during processing method.
+ */
+ protected List getSchemaNamespaceList(Definition definition)
+ throws WSIException
+ {
+ List list = new Vector();
+
+ // Always add current document targetNamespace
+ List targetNamespaceList = getSchemaTargetNamespaceList(definition);
+
+ if ((targetNamespaceList != null) && !targetNamespaceList.isEmpty())
+ list.addAll(targetNamespaceList);
+
+ // Get list of imported WSDL documents
+ Map importMap = definition.getImports();
+
+ Import imp;
+
+ // Add each imports targetNamespace to the list
+ if (importMap != null && !importMap.isEmpty())
+ {
+ Iterator values = importMap.values().iterator();
+ List importList;
+ while (values.hasNext())
+ {
+ importList = (List) values.next();
+ Iterator imports = importList.iterator();
+ while (imports.hasNext())
+ {
+ imp = (Import) imports.next();
+ if (imp != null && imp.getDefinition() != null)
+ list.addAll(getSchemaNamespaceList(imp.getDefinition()));
+ }
+ }
+ }
+
+ return list;
+ }
+
+ /**
+ * Build list of WSDL targetNamespaces.
+ * @param definition a Definition object.
+ * @return list of WSDL targetNamespaces.
+ */
+ protected List getWSDLTargetNamespaceList(Definition definition)
+ {
+ List list = new Vector();
+
+ // Always add current document targetNamespace
+ if (definition.getTargetNamespace() != null)
+ list.add(definition.getTargetNamespace());
+
+ // Get list of imported WSDL documents
+ Map importMap = definition.getImports();
+
+ Import imp;
+
+ // Add each imports targetNamespace to the list
+ if (importMap != null && !importMap.isEmpty())
+ {
+ Iterator values = importMap.values().iterator();
+ List importList;
+ while (values.hasNext())
+ {
+ importList = (List) values.next();
+ Iterator imports = importList.iterator();
+ while (imports.hasNext())
+ {
+ imp = (Import) imports.next();
+ if (imp != null && imp.getDefinition() != null)
+ list.addAll(getWSDLTargetNamespaceList(imp.getDefinition()));
+ // list.add(imp.getDefinition().getTargetNamespace());
+ }
+ }
+ }
+
+ return list;
+ }
+
+ protected class BindingMatch
+ {
+ private Binding binding;
+ private BindingOperation bindingOperation;
+ private SOAPBinding soapBinding;
+ //private Vector bindingArgs; // set of BindingInputs and BindingOutputs
+ private BindingInput bindingInput;
+ private BindingOutput bindingOutput;
+
+ // ADD: need to include BindingFault support...
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingInput bin,
+ BindingOutput bout)
+ {
+ binding = b;
+ bindingOperation = bo;
+ soapBinding = sb;
+ //bindingArgs = new Vector();
+ //if (bin != null) { bindingArgs.add(bin); }
+ //if (bout != null) { bindingArgs.add(bout); }
+ bindingInput = bin;
+ bindingOutput = bout;
+ }
+
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingInput bin)
+ {
+ this(b, bo, sb, bin, null);
+ }
+
+ public BindingMatch(
+ Binding b,
+ BindingOperation bo,
+ SOAPBinding sb,
+ BindingOutput bout)
+ {
+ this(b, bo, sb, null, bout);
+ }
+
+ /**
+ * Returns the soapBinding.
+ * @return SOAPBinding
+ */
+ public SOAPBinding getSoapBinding()
+ {
+ return soapBinding;
+ }
+
+ /**
+ * Returns the bindingOperation.
+ * @return BindingOperation
+ */
+ public BindingOperation getBindingOperation()
+ {
+ return bindingOperation;
+ }
+
+ /**
+ * Returns the bindingInput.
+ * @return BindingInput
+ */
+ public BindingInput getBindingInput()
+ {
+ return bindingInput;
+ }
+
+ /**
+ * Returns the bindingOutput.
+ * @return BindingOutput
+ */
+ public BindingOutput getBindingOutput()
+ {
+ return bindingOutput;
+ }
+
+ public boolean hasBindingInput()
+ {
+ return (this.bindingInput != null);
+ }
+
+ public boolean hasBindingOutput()
+ {
+ return (this.bindingOutput != null);
+ }
+
+ /**
+ * Returns the binding.
+ * @return Binding
+ */
+ public Binding getBinding()
+ {
+ return binding;
+ }
+
+ }
+
+ /**
+ * Get binding matches.
+ * @param binding a binding.
+ * @param soapBindingStyle soap binding style.
+ * @param soapBodyUse soap body use.
+ * @return binding matches.
+ * @throws WSIException if problems occur during processing.
+ */
+ public BindingMatch[] getBindingMatches(
+ Binding binding,
+ String soapBindingStyle,
+ String soapBodyUse)
+ throws WSIException
+ {
+
+ Vector bindingMatches = new Vector();
+
+ // Check binding
+ SOAPBinding soapBinding = getSoapBinding(binding);
+
+ // check that the soap:binding for this WSDL binding is the specified style
+ // ADD: check for null pointer
+ if (soapBinding != null)
+ {
+ String defaultStyle = soapBinding.getStyle();
+
+ if (defaultStyle == null)
+ {
+ defaultStyle = WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC;
+ }
+
+ // Get the set of operations for this WSDL binding
+ List bindingOpsList = binding.getBindingOperations();
+ if (bindingOpsList != null)
+ {
+ Iterator bindingOps = bindingOpsList.iterator();
+ // for each binding operation:
+ while (bindingOps.hasNext())
+ {
+ BindingOperation bindingOp = (BindingOperation) bindingOps.next();
+
+ SOAPOperation soapOp = getSoapOperation(bindingOp);
+
+ if ((soapOp == null && defaultStyle.equals(soapBindingStyle))
+ || (soapOp != null
+ && soapOp.getStyle() == null
+ && defaultStyle.equals(soapBindingStyle))
+ || (soapOp != null
+ && soapOp.getStyle() != null
+ && soapOp.getStyle().equals(soapBindingStyle)))
+ {
+ // check binding input & output
+ BindingInput bInput = bindingOp.getBindingInput();
+ if (bInput != null)
+ {
+ SOAPBody inputSoapBody = getSoapBody(bInput);
+ if (inputSoapBody == null
+ || (inputSoapBody.getUse() != null
+ && !inputSoapBody.getUse().equals(soapBodyUse)))
+ {
+ bInput = null;
+ }
+ }
+
+ BindingOutput bOutput = bindingOp.getBindingOutput();
+ if (bOutput != null)
+ {
+ SOAPBody outputSoapBody = getSoapBody(bOutput);
+
+ if (outputSoapBody == null
+ || (outputSoapBody.getUse() != null
+ && !outputSoapBody.getUse().equals(soapBodyUse)))
+ {
+ bOutput = null;
+ }
+ }
+
+ if ((bOutput != null) || (bInput != null))
+ {
+ // we have a match, add to the vector
+ bindingMatches.add(
+ new BindingMatch(
+ binding,
+ bindingOp,
+ soapBinding,
+ bInput,
+ bOutput));
+ }
+ }
+ }
+ }
+ }
+
+ BindingMatch[] BindingMatchArray = new BindingMatch[bindingMatches.size()];
+ bindingMatches.copyInto(BindingMatchArray);
+ return BindingMatchArray;
+ }
+
+ /**
+ * Method getSoapOperation.
+ *
+ * @param bindingOperation a binding operation.
+ * @return a soap operation.
+ * @throws WSIException if problems while processing.
+ */
+ public static SOAPOperation getSoapOperation(BindingOperation bindingOperation)
+ throws WSIException
+ {
+
+ if (bindingOperation.getExtensibilityElements() == null)
+ {
+ return null;
+ }
+
+ Iterator extensibles =
+ bindingOperation.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPOperation)
+ {
+ return (SOAPOperation) extensible;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * Returns an array of SOAPOperations corresponding to the wsdl:binding supplied.
+ */
+ protected HashMap getSoapOperations(Binding binding) throws WSIException
+ {
+ HashMap soapOperationList = new HashMap();
+
+ if (binding.getBindingOperations() == null)
+ {
+ return null;
+ }
+
+ //Vector soapOpVector = new Vector();
+
+ // Get the list of binding operations
+ Iterator operations = binding.getBindingOperations().iterator();
+
+ // Check each binding operation to see if it has a soap operation element
+ BindingOperation bindingOperation = null;
+ while (operations.hasNext())
+ {
+ bindingOperation = (BindingOperation) operations.next();
+ Iterator extensibles =
+ bindingOperation.getExtensibilityElements().iterator();
+ while (extensibles.hasNext())
+ {
+ Object extensible = extensibles.next();
+ if (extensible instanceof SOAPOperation)
+ {
+ soapOperationList.put(extensible, bindingOperation.getName());
+ }
+ }
+ }
+
+ //return (SOAPOperation[])soapOpVector.toArray(new SOAPOperation[] {});
+ return soapOperationList;
+ }
+
+ /**
+ * Check part attributes.
+ * @param bindingMatch an array of BindingMatch objects.
+ * @param inOrOut a String object.
+ * @param attrib attribute.
+ * @return a boolean.
+ * @throws AssertionFailException if the part is not compliant.
+ */
+ // GT - rework this method with a better way of parameterizing the getters required for the invocation.
+ protected boolean checkPartAttributes(
+ BindingMatch[] bindingMatch,
+ String inOrOut,
+ String attrib)
+ throws AssertionFailException
+ {
+
+ if (!(inOrOut.equals("useInput") || inOrOut.equals("useOutput"))
+ || !(attrib.equals("useType") || attrib.equals("useElement")))
+ {
+ // invalid argument value supplied by calling method - "internal error"
+ return false;
+ }
+
+ for (int i = 0; i < bindingMatch.length; i++)
+ {
+ BindingMatch nextMatch = bindingMatch[i];
+
+ // check the associated parts
+ Message msg;
+ Map parts;
+ Iterator partIteration;
+
+ BindingOperation bindingOp = nextMatch.getBindingOperation();
+ if (bindingOp == null)
+ {
+ continue; // no Binding Operation for some reason
+ }
+
+ Operation op = bindingOp.getOperation();
+
+ /* ADD: handle soap:faults in similar way
+ try {
+ // check faults - remarkably similar.... (need to retain operation id for failuredetail msg)
+ if (nextMatch.hasBindingFault()) {
+
+ msg = op.getFault().getMessage();
+ parts = msg.getParts();
+
+ //check that each part has an element attribute
+ partIteration = parts.values().iterator();
+ while (partIteration.hasNext()) {
+ Part part = (Part)partIteration.next();
+ if (part.getElementName() == null) {
+ throw new AssertionFailException("OPERATION: " + op + "MESSAGE: " + msg);
+ }
+ }
+ }
+ }
+ catch (NullPointerException n) {
+ // no parts found - this qualifies an assertion failure
+ throw new AssertionFailException(n.getMessage());
+ }
+ */
+
+ try
+ {
+
+ QName attributeName;
+
+ //GT: Do we need to check BindingInput / Output here ??
+
+ if (inOrOut.equals("useInput"))
+ {
+ if (op.getInput() == null || !nextMatch.hasBindingInput())
+ {
+ // No Input so nothing to check
+ continue;
+ }
+
+ msg = op.getInput().getMessage();
+
+ }
+ else
+ { // Looking for Output
+ if (op.getOutput() == null || !nextMatch.hasBindingOutput())
+ {
+ // No Output so nothing to check
+ continue;
+ }
+
+ msg = op.getOutput().getMessage();
+ }
+
+ if (msg == null)
+ {
+ continue; // nothing to check from this Binding Match (?)
+ }
+
+ // Get the list of parts
+ parts = msg.getParts();
+
+ // If there is a parts attribute, then only process those parts
+ List partsNameList = null;
+ if ((partsNameList = getPartsList(nextMatch, inOrOut)) != null)
+ {
+ Vector partsList = new Vector();
+ Iterator partsNameIterator = partsNameList.iterator();
+ while (partsNameIterator.hasNext())
+ {
+ partsList.add(parts.get((String) partsNameIterator.next()));
+ }
+ partIteration = partsList.iterator();
+ }
+
+ // Otherwise use the complete list of parts
+ else
+ {
+ partIteration = parts.values().iterator();
+ }
+
+ //check that each part has an element or type attribute
+ while (partIteration.hasNext())
+ {
+ Part part = (Part) partIteration.next();
+ if (attrib.equals("useElement"))
+ {
+ attributeName = part.getElementName();
+ }
+ else
+ { // "useType"
+ attributeName = part.getTypeName();
+ }
+
+ if (attributeName == null)
+ {
+ throw new AssertionFailException(
+ "Name of operation that failed: "
+ + op.getName()
+ + "\n"
+ + op.toString()
+ + "\n"
+ + "\nName of message that failed: "
+ + msg.getQName()
+ + "\n"
+ + msg.toString());
+ }
+ }
+ }
+ catch (NullPointerException n)
+ {
+ // no parts found - this qualifies an assertion failure
+ throw new AssertionFailException(n.toString());
+ }
+ }
+ return true; // tests successful
+ }
+
+ /**
+ * Get parts list from a soapbind:body element.
+ */
+ private List getPartsList(BindingMatch bindingMatch, String type)
+ {
+ List partsList = null;
+ Iterator iterator = null;
+
+ BindingOperation bindingOp;
+
+ try
+ {
+ // Get the binding operation
+ bindingOp = bindingMatch.getBindingOperation();
+
+ // Determine if the binding operation contains a soapbind:body with a parts attribute
+ if (type.equals("useInput"))
+ {
+ iterator =
+ bindingOp.getBindingInput().getExtensibilityElements().iterator();
+ }
+ else
+ {
+ iterator =
+ bindingOp.getBindingOutput().getExtensibilityElements().iterator();
+ }
+ }
+ catch (NullPointerException e)
+ {
+ return null;
+ // either no binding operation, binding input/output, or SOAP element
+ }
+
+ // Determine if the binding operation contains a soapbind:body with a parts attribute
+ while ((iterator.hasNext()) && (partsList == null))
+ {
+ try
+ {
+ SOAPBody soapBody = (SOAPBody) iterator.next();
+ partsList = soapBody.getParts();
+ }
+ catch (ClassCastException cce)
+ { // not a SOAPBody extensibility element so ignore
+ }
+ }
+
+ return partsList;
+ }
+
+ /**
+ * Get element location.
+ * @param wsdlDocument WSDL document.
+ * @param wsdlElement WSDL element.
+ * @return element location.
+ */
+ protected ElementLocation getElementLocation(
+ WSDLDocument wsdlDocument,
+ Object wsdlElement)
+ {
+ ElementLocation elementLocation = null;
+ WSDLElementList wsdlElementList;
+
+ if ((wsdlElementList = wsdlDocument.getElementList()) != null)
+ {
+ elementLocation = wsdlElementList.getElementLocation(wsdlElement);
+ }
+
+ return elementLocation;
+ }
+
+ /**
+ * Create failure detail.
+ * @param message a message.
+ * @param entryContext entry context.
+ * @return failure detail.
+ */
+ protected FailureDetail createFailureDetail(
+ String message,
+ EntryContext entryContext)
+ {
+ return createFailureDetail(
+ message,
+ entryContext,
+ entryContext.getEntry().getEntryDetail());
+ }
+
+ /**
+ * Create failure detail.
+ * @param message a message.
+ * @param entryContext entry context.
+ * @param wsdlElement WSDL element.
+ * @return failure detail.
+ */
+ protected FailureDetail createFailureDetail(
+ String message,
+ EntryContext entryContext,
+ Object wsdlElement)
+ {
+ FailureDetail failureDetail = reporter.createFailureDetail();
+ failureDetail.setFailureMessage(message);
+ failureDetail.setElementLocation(
+ getElementLocation(entryContext.getWSDLDocument(), wsdlElement));
+ return failureDetail;
+ }
+
+ /**
+ * SOAPBody, SOAPFault, SOAPHeader and SOAPHeaderFault class
+ * interfaces have compatible getUse() and getNamespaceURI()
+ * methods, but wsdl4j does not declare them at the parent interface.
+ * Therefore use reflection to access these common methods.
+ *
+ * @param extElement extensibility element.
+ * @return true if namespace is found in SOAP literal.
+ * @throws NoSuchMethodException if this method cannot be found.
+ * @throws InvocationTargetException if problems occur in an invoked method or constructor
+ * @throws IllegalAccessException if there is am attempt to load a
+ * class that it does not have access to.
+ */
+ protected boolean namespaceFoundInSoapLiteral(ExtensibilityElement extElement)
+ throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+ Class c = extElement.getClass();
+ Method getUseMethod = c.getMethod("getUse", new Class[0]);
+ Method getNamespaceURIMethod = c.getMethod("getNamespaceURI", new Class[0]);
+
+ // (use attribute is mandatory but the null case is checked for since a missing use is not
+ // checked with this TA. If its missing its invalid but we don't know whether we have doc-lit).
+ if (getUseMethod.invoke(extElement, null) == null
+ || !getUseMethod.invoke(extElement, null).equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ return false;
+ }
+
+ // return true if namespace found
+ boolean namespaceFound =
+ (getNamespaceURIMethod.invoke(extElement, null) != null);
+
+ // return true if namespace found
+ return namespaceFound;
+
+ }
+
+ /**
+ * Verify extensibility element uses literal.
+ * @param extensible - extensibility element
+ * @return boolean
+ * @throws NoSuchMethodException if this method cannot be found.
+ * @throws InvocationTargetException if problems occur in an invoked method or constructor
+ * @throws IllegalAccessException if there is am attempt to load a
+ * class that it does not have access to.
+ */
+ protected boolean isLiteral(ExtensibilityElement extensible)
+ throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
+ {
+
+ Class c = extensible.getClass();
+ Method getUseMethod = c.getMethod("getUse", new Class[0]);
+
+ // (use attribute is mandatory but the null case is checked for since a missing use is not
+ // checked with this TA. If its missing its invalid but we don't know whether we have doc-lit).
+ if (getUseMethod.invoke(extensible, null) == null
+ || !getUseMethod.invoke(extensible, null).equals(
+ WSIConstants.ATTRVAL_SOAP_BODY_USE_LIT))
+ {
+ return false;
+ }
+
+ // return true if shown to have use="literal"
+ return true;
+
+ }
+}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2010.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2010.java
new file mode 100644
index 000000000..4b39b5d48
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2010.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2010
+ */
+public class WSI2010 extends BP2010
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2010(WSDLValidatorImpl 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/wsdl/WSI2011.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2011.java
new file mode 100644
index 000000000..61d5da778
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2011.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2011
+ */
+public class WSI2011 extends BP2011
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2011(WSDLValidatorImpl 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/wsdl/WSI2012.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2012.java
new file mode 100644
index 000000000..21d9ef231
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2012.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2012
+ */
+public class WSI2012 extends BP2012
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2012(WSDLValidatorImpl 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/wsdl/WSI2013.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2013.java
new file mode 100644
index 000000000..d4f01cf16
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2013.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2013
+ */
+public class WSI2013 extends BP2013
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2013(WSDLValidatorImpl 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/wsdl/WSI2014.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2014.java
new file mode 100644
index 000000000..fbb6a6ae2
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2014.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2014
+ */
+public class WSI2014 extends BP2014
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2014(WSDLValidatorImpl 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/wsdl/WSI2017.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2017.java
new file mode 100644
index 000000000..93e9820b6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2017.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2017
+ */
+public class WSI2017 extends BP2017
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2017(WSDLValidatorImpl 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/wsdl/WSI2018.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2018.java
new file mode 100644
index 000000000..3845e3130
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2018.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2018
+ */
+public class WSI2018 extends BP2018
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2018(WSDLValidatorImpl 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/wsdl/WSI2019.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2019.java
new file mode 100644
index 000000000..fb197f277
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2019.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2019
+ */
+public class WSI2019 extends BP2019
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2019(WSDLValidatorImpl 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/wsdl/WSI2020.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2020.java
new file mode 100644
index 000000000..25f0206d4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2020.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2020
+ */
+public class WSI2020 extends BP2020
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2020(WSDLValidatorImpl 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/wsdl/WSI2021.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2021.java
new file mode 100644
index 000000000..437f1bc35
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2021.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2021
+ */
+public class WSI2021 extends BP2021
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2021(WSDLValidatorImpl 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/wsdl/WSI2022.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2022.java
new file mode 100644
index 000000000..826996572
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2022.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2022
+ */
+public class WSI2022 extends BP2022
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2022(WSDLValidatorImpl 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/wsdl/WSI2032.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2032.java
new file mode 100644
index 000000000..6c07ac1a6
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2032.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2032
+ */
+public class WSI2032 extends BP2032
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2032(WSDLValidatorImpl 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/wsdl/WSI2098.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2098.java
new file mode 100644
index 000000000..82a905c27
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2098.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2098
+ */
+public class WSI2098 extends BP2098
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2098(WSDLValidatorImpl 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/wsdl/WSI2099.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2099.java
new file mode 100644
index 000000000..514b52c08
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2099.java
@@ -0,0 +1,157 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.BindingFault;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Fault;
+import javax.wsdl.Import;
+import javax.wsdl.Input;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.Element;
+
+
+/**
+ * WSI2099.
+ * <context>For a candidate wsdl:definitions, </context>
+ * <assertionDescription>A WS-I conformance annotation does not appear outside a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message element.</assertionDescription>
+ */
+public class WSI2099 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2099(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private ErrorList errors = new ErrorList();
+ private boolean containsClaims = false;
+
+ /**
+ * Check a WS-I conformance annotation does not appear outside a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message element if not it creates failure report.
+ * @see org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLVisitor#visit(org.w3c.dom.Element, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Element el, Object parent, WSDLTraversalContext ctx)
+ {
+ // conformance claim should be within : port, binding, porttype, operation, message
+ if (containsConformanceClaim(el))
+ {
+ containsClaims = true;
+
+ if (parent instanceof BindingFault)
+ errors.add(WSDL_FAULT, ((BindingFault) parent).getName());
+ else if (parent instanceof BindingInput)
+ errors.add(WSDL_INPUT, ((BindingInput) parent).getName());
+ else if (parent instanceof BindingOperation)
+ errors.add(WSDL_OPERATION, ((BindingOperation) parent).getName());
+ else if (parent instanceof BindingOutput)
+ errors.add(WSDL_OUTPUT, ((BindingOutput) parent).getName());
+ else if (parent instanceof Definition)
+ errors.add(WSDL_DEFINITIONS, ((Definition) parent).getQName());
+ else if (parent instanceof Service)
+ errors.add(WSDL_SERVICE, ((Service) parent).getQName());
+ else if (parent instanceof Fault)
+ errors.add(WSDL_FAULT, ((Fault) parent).getName());
+ else if (parent instanceof Output)
+ errors.add(WSDL_INPUT, ((Output) parent).getName());
+ else if (parent instanceof Import)
+ errors.add(WSDL_IMPORT, ((Import) parent).getNamespaceURI());
+ else if (parent instanceof Input)
+ errors.add(WSDL_INPUT, ((Input) parent).getName());
+ else if (parent instanceof Part)
+ errors.add(WSDL_PART, ((Part) parent).getName());
+ else if (parent instanceof Types)
+ errors.add(WSDL_TYPES);
+ }
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitElement(true);
+ /*
+ traversal.
+ ignorePort2Element().
+ ignoreMessage2Element().
+ ignoreBinding2Element().
+ ignorePortType2Element().
+ ignoreOperation2Element();
+ */
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ // create detail message with the list of error elements
+ if (!errors.isEmpty())
+ {
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ else if (!containsClaims)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+
+ else
+ {
+ result = AssertionResult.RESULT_PASSED;
+ }
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim.
+ * @param el
+ * @return boolean
+ */
+ private boolean containsConformanceClaim(Element el)
+ {
+ if (el == null)
+ return false;
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+ return (el != 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/wsdl/WSI2100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2100.java
new file mode 100644
index 000000000..da15585c4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2100.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+
+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.report.AssertionResult;
+import org.eclipse.wst.wsi.internal.core.util.ErrorList;
+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.Element;
+
+
+/**
+ * WSI2100.
+ * <context>For a candidate wsdl:definitions, if it contains a wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message, which in turn contains a conformance annotation</context>
+ * <assertionDescription>The conformance annotation of the wsdl:port, wsdl:binding, wsdl:portType, wsdl:operation, or wsdl:message, validates to the schema defined in the Basic Profile, and is direct child of the documentation element for the WSDL element. The schema definition uses "http://ws-i.org/schemas/conformanceClaim/" as the targetNamespace. </assertionDescription>
+ */
+public class WSI2100 extends AssertionProcessVisitor implements WSITag
+{
+ private final WSDLValidatorImpl validator;
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2100(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ this.validator = impl;
+ }
+
+ private boolean containsClaims = false;
+ private ErrorList errors = new ErrorList();
+
+ /* Create falure report if port contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Port port, Object parent, WSDLTraversalContext ctx)
+ {
+ if (port != null && !containsLegalClaim(port.getDocumentationElement()))
+ errors.add(WSDL_PORT, port.getName());
+ }
+
+ /* Create falure report if binding contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Binding, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Binding binding, Object parent, WSDLTraversalContext ctx)
+ {
+ if (binding != null
+ && !containsLegalClaim(binding.getDocumentationElement()))
+ errors.add(WSDL_BINDING, binding.getQName());
+ }
+
+ /* Create falure report if port type contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.PortType, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(PortType type, Object parent, WSDLTraversalContext ctx)
+ {
+ if (type != null && !containsLegalClaim(type.getDocumentationElement()))
+ errors.add(WSDL_PORTTYPE, type.getQName());
+ }
+
+ /* Create falure report if operation contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Operation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(
+ Operation operation,
+ Object parent,
+ WSDLTraversalContext ctx)
+ {
+ if (operation != null
+ && !containsLegalClaim(operation.getDocumentationElement()))
+ errors.add(WSDL_OPERATION, operation.getName());
+ }
+
+ /* Create falure report if message contains illegal claim.
+ * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Message, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext)
+ */
+ public void visit(Message message, Object parent, WSDLTraversalContext ctx)
+ {
+ if (message != null
+ && !containsLegalClaim(message.getDocumentationElement()))
+ errors.add(WSDL_MESSAGE, message.getQName());
+ }
+
+ /* 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
+ {
+ result = AssertionResult.RESULT_FAILED;
+
+ WSDLTraversal traversal = new WSDLTraversal();
+ //VisitorAdaptor.adapt(this);
+ traversal.setVisitor(this);
+ traversal.visitOperation(true);
+ traversal.visitBinding(true);
+ traversal.visitMessage(true);
+ traversal.visitPort(true);
+ traversal.visitPortType(true);
+ traversal.ignoreReferences();
+ traversal.ignoreImport();
+ traversal.traverse((Definition) entryContext.getEntry().getEntryDetail());
+
+ // create detail message with the list of error elements
+ if (!errors.isEmpty())
+ {
+ failureDetail = this.validator.createFailureDetail(errors.toString(), entryContext);
+ result = AssertionResult.RESULT_FAILED;
+ }
+
+ else if (!containsClaims)
+ {
+ result = AssertionResult.RESULT_NOT_APPLICABLE;
+ }
+ else
+ result = AssertionResult.RESULT_PASSED;
+
+ return validator.createAssertionResult(testAssertion, result, failureDetail);
+ }
+
+ /**
+ * Check the documentation element whether contains conformance claims.
+ * Returns true if documentation element contains conformance claim with
+ * illegal schema definition URI.
+ * legal is 'http://ws-i.org/schemas/conformanceClaim/'
+ * @param el
+ * @return boolean
+ */
+ private boolean containsLegalClaim(Element el)
+ {
+ if (el == null)
+ return true;
+ // find claim
+ el = XMLUtils.findChildElement(el, WSI_CLAIM);
+
+ if (el != null)
+ containsClaims = true;
+
+ while (el != null)
+ {
+ if (XMLUtils.getAttribute(el, ATTR_CLAIM_CONFORMSTO) == null
+ || XMLUtils.getAttribute(el, ATTR_SOAP_MUSTUNDERSTAND) != null)
+ return false;
+ el = XMLUtils.findElement(el, WSI_CLAIM);
+ }
+ 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/wsdl/WSI2101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2101.java
new file mode 100644
index 000000000..68f09db6a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2101.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2101
+ */
+public class WSI2101 extends BP2101
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2101(WSDLValidatorImpl 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/wsdl/WSI2102.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2102.java
new file mode 100644
index 000000000..63627d05c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2102.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2102
+ */
+public class WSI2102 extends BP2102
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2102(WSDLValidatorImpl 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/wsdl/WSI2103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2103.java
new file mode 100644
index 000000000..bb75f197c
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2103.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2103
+ */
+public class WSI2103 extends BP2103
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2103(WSDLValidatorImpl 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/wsdl/WSI2104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2104.java
new file mode 100644
index 000000000..b7427795e
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2104.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2104
+ */
+public class WSI2104 extends BP2104
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2104(WSDLValidatorImpl 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/wsdl/WSI2105.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2105.java
new file mode 100644
index 000000000..bbbddfeec
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2105.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2105
+ */
+public class WSI2105 extends BP2105
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2105(WSDLValidatorImpl 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/wsdl/WSI2107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2107.java
new file mode 100644
index 000000000..dc5742fd8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2107.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2107
+ */
+public class WSI2107 extends BP2107
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2107(WSDLValidatorImpl 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/wsdl/WSI2108.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2108.java
new file mode 100644
index 000000000..746beaa3f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2108.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2108
+ */
+public class WSI2108 extends BP2108
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2108(WSDLValidatorImpl 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/wsdl/WSI2110.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2110.java
new file mode 100644
index 000000000..e70cc4d30
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2110.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2110
+ */
+public class WSI2110 extends BP2110
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2110(WSDLValidatorImpl 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/wsdl/WSI2111.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2111.java
new file mode 100644
index 000000000..ef9286fb9
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2111.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2111
+ */
+public class WSI2111 extends BP2111
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2111(WSDLValidatorImpl 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/wsdl/WSI2112.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2112.java
new file mode 100644
index 000000000..ed40abe32
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2112.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2112
+ */
+public class WSI2112 extends BP2112
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2112(WSDLValidatorImpl 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/wsdl/WSI2113.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2113.java
new file mode 100644
index 000000000..0c1189792
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2113.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2113
+ */
+public class WSI2113 extends BP2113
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2113(WSDLValidatorImpl 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/wsdl/WSI2114.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2114.java
new file mode 100644
index 000000000..ef55a24eb
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2114.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2114
+ */
+public class WSI2114 extends BP2114
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2114(WSDLValidatorImpl 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/wsdl/WSI2115.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2115.java
new file mode 100644
index 000000000..916ef7a3d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2115.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2115
+ */
+public class WSI2115 extends BP2115
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2115(WSDLValidatorImpl 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/wsdl/WSI2116.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2116.java
new file mode 100644
index 000000000..03358e71d
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2116.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2116
+ */
+public class WSI2116 extends BP2116
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2116(WSDLValidatorImpl 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/wsdl/WSI2117.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2117.java
new file mode 100644
index 000000000..87b377cb3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2117.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2117
+ */
+public class WSI2117 extends BP2117
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2117(WSDLValidatorImpl 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/wsdl/WSI2118.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2118.java
new file mode 100644
index 000000000..d6d33076b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2118.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2118
+ */
+public class WSI2118 extends BP2118
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2118(WSDLValidatorImpl 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/wsdl/WSI2119.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2119.java
new file mode 100644
index 000000000..1416ce33a
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2119.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2119
+ */
+public class WSI2119 extends BP2119
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2119(WSDLValidatorImpl 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/wsdl/WSI2120.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2120.java
new file mode 100644
index 000000000..4f2e205b7
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2120.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2120
+ */
+public class WSI2120 extends BP2120
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2120(WSDLValidatorImpl 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/wsdl/WSI2122.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2122.java
new file mode 100644
index 000000000..22994ec84
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2122.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2122
+ */
+public class WSI2122 extends BP2122
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2122(WSDLValidatorImpl 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/wsdl/WSI2123.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2123.java
new file mode 100644
index 000000000..44f05a6b4
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2123.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2123
+ */
+public class WSI2123 extends BP2123
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2123(WSDLValidatorImpl 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/wsdl/WSI2201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2201.java
new file mode 100644
index 000000000..696457c71
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2201.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2201
+ */
+public class WSI2201 extends BP2201
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2201(WSDLValidatorImpl 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/wsdl/WSI2202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2202.java
new file mode 100644
index 000000000..ebb59f35f
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2202.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2202
+ */
+public class WSI2202 extends BP2202
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2202(WSDLValidatorImpl 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/wsdl/WSI2208.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2208.java
new file mode 100644
index 000000000..4ed71303b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2208.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2208
+ */
+public class WSI2208 extends BP2208
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2208(WSDLValidatorImpl 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/wsdl/WSI2402.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2402.java
new file mode 100644
index 000000000..10c57852b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2402.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2402
+ */
+public class WSI2402 extends BP2402
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2402(WSDLValidatorImpl 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/wsdl/WSI2403.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2403.java
new file mode 100644
index 000000000..8facd42e0
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2403.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2403
+ */
+public class WSI2403 extends SSBP2403
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2403(WSDLValidatorImpl 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/wsdl/WSI2404.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2404.java
new file mode 100644
index 000000000..9dfa8e9c8
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2404.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2404
+ */
+public class WSI2404 extends BP2404
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2404(WSDLValidatorImpl 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/wsdl/WSI2406.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2406.java
new file mode 100644
index 000000000..c6d420a79
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2406.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2406
+ */
+public class WSI2406 extends BP2406
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2406(WSDLValidatorImpl 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/wsdl/WSI2416.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2416.java
new file mode 100644
index 000000000..770bf3f6b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2416.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2416
+ */
+public class WSI2416 extends BP2416
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2416(WSDLValidatorImpl 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/wsdl/WSI2417.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2417.java
new file mode 100644
index 000000000..7c2383641
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2417.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2417
+ */
+public class WSI2417 extends BP2417
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2417(WSDLValidatorImpl 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/wsdl/WSI2700.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2700.java
new file mode 100644
index 000000000..39bbb363b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2700.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2700
+ */
+public class WSI2700 extends BP2700
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2700(WSDLValidatorImpl 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/wsdl/WSI2701.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2701.java
new file mode 100644
index 000000000..4337f53d3
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2701.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2701
+ */
+public class WSI2701 extends BP2701
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2701(WSDLValidatorImpl 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/wsdl/WSI2703.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2703.java
new file mode 100644
index 000000000..54637088b
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI2703.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI2703
+ */
+public class WSI2703 extends BP2703
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI2703(WSDLValidatorImpl 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/wsdl/WSI4200.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4200.java
new file mode 100644
index 000000000..ed43a7c31
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4200.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI4200
+ */
+public class WSI4200 extends BP4200
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4200(WSDLValidatorImpl 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/wsdl/WSI4201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4201.java
new file mode 100644
index 000000000..f7233d977
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4201.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI4201
+ */
+public class WSI4201 extends BP4201
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4201(WSDLValidatorImpl 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/wsdl/WSI4202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4202.java
new file mode 100644
index 000000000..92d9baed5
--- /dev/null
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/wsdl/WSI4202.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * 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.wsdl;
+
+/**
+ * WSI4202
+ */
+public class WSI4202 extends BP4202
+{
+
+ /**
+ * @param WSDLValidatorImpl
+ */
+ public WSI4202(WSDLValidatorImpl impl)
+ {
+ super(impl);
+ }
+} \ No newline at end of file

Back to the top