Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 15:13:20 -0500 (Fri, 29 Feb 2008)
New Revision: 5873
Added:
stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/NonValidatingEndpoint.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.java
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/wsdl/
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl
Removed:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java
stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl
stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd
Modified:
stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContent.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml
Log:
[JBWS-1172] Support schema validation for incoming/outgoing messages
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-29 18:59:14 UTC (rev
5872)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-29 20:13:20 UTC (rev
5873)
@@ -213,9 +213,13 @@
<!-- jaxws-jbws1172 -->
<war destfile="${tests.output.dir}/libs/jaxws-jbws1172.war"
webxml="${tests.output.dir}/resources/jaxws/jbws1172/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
- <include
name="org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws1172/NonValidatingEndpoint.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.class"/>
<include name="org/jboss/test/ws/jaxws/jbws1172/types/*.class"/>
</classes>
+ <webinf
dir="${tests.output.dir}/resources/jaxws/jbws1172/WEB-INF">
+ <include name="wsdl/**"/>
+ </webinf>
</war>
<!-- jaxws-jbws1178 -->
Added: stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.annotation;
+
+// $Id$
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+import org.jboss.ws.extensions.validation.ValidationErrorHandler;
+
+/**
+ * This feature represents the use of schema validation with a
+ * web service.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+@Retention(value = RetentionPolicy.RUNTIME)
+@Target(value = { ElementType.TYPE })
+public @interface SchemaValidation
+{
+ /**
+ * Optional property for the schema location. If this is not specified the schema
+ * will be attempted to extract from the WSDL.
+ *
+ * The syntax is the same as for schemaLocation attributes in instance documents: e.g,
"http://www.example.com file_name.xsd".
+ */
+ String schemaLocation() default "";
+
+ /**
+ * Optional property for the error handler.
+ * If this is not specified the @{ValidationErrorHandler} will be used.
+ */
+ Class errorHandler() default ValidationErrorHandler.class;
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -565,7 +565,7 @@
featureSet.add(feature);
EndpointMetaData epMetaData = ((StubExt)stub).getEndpointMetaData();
- epMetaData.setFeatures(featureSet);
+ epMetaData.setWebServiceFeatures(featureSet);
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -21,14 +21,24 @@
*/
package org.jboss.ws.core.soap;
+import java.net.URL;
+
import javax.xml.namespace.QName;
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBodyElement;
+import javax.xml.transform.Source;
import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
import org.jboss.ws.core.CommonMessageContext;
import org.jboss.ws.core.soap.SOAPContent.State;
+import org.jboss.ws.core.utils.SchemaValidationHelper;
+import org.jboss.ws.extensions.validation.SchemaExtractor;
import org.jboss.ws.feature.SchemaValidationFeature;
+import org.jboss.ws.metadata.umdm.EndpointMetaData;
+import org.jboss.wsf.common.DOMUtils;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
/**
* An abstract implemenation of the SOAPBodyElement
@@ -44,7 +54,6 @@
private static Logger log = Logger.getLogger(SOAPBodyElementDoc.class);
private SchemaValidationFeature feature;
- private boolean validated;
public SOAPBodyElementDoc(Name name)
{
@@ -67,30 +76,71 @@
State prevState = soapContent.getState();
if (nextState != prevState)
{
- if (doValidation() && nextState == State.OBJECT_VALID)
+ if (isValidationEnabled() && nextState == State.OBJECT_VALID)
{
log.info("Validating: " + prevState);
- validated = true;
+ validatePayload(soapContent.getPayload());
}
- log.info(prevState + "=>" + nextState);
prevState = super.transitionTo(nextState);
- if (doValidation() && prevState == State.OBJECT_VALID)
+ if (isValidationEnabled() && prevState == State.OBJECT_VALID)
{
log.info("Validating: " + nextState);
- validated = true;
+ validatePayload(soapContent.getPayload());
}
}
return prevState;
}
- private boolean doValidation()
+ private void validatePayload(Source source)
{
+ SchemaExtractor schemaExtractor = new SchemaExtractor();
+ try
+ {
+ CommonMessageContext msgContext =
MessageContextAssociation.peekMessageContext();
+ EndpointMetaData epMetaData = msgContext.getEndpointMetaData();
+ feature = epMetaData.getWebServiceFeature(SchemaValidationFeature.class);
+ URL xsdURL = feature.getSchemaLocation() != null ? new
URL(feature.getSchemaLocation()) : null;
+ if (xsdURL == null)
+ {
+ URL wsdlURL = epMetaData.getServiceMetaData().getWsdlFileOrLocation();
+ if (wsdlURL == null)
+ {
+ log.warn("Validation error: Cannot obtain wsdl URL");
+ }
+ else
+ {
+ xsdURL = schemaExtractor.getSchemaUrl(wsdlURL);
+ }
+ }
+ if (xsdURL != null)
+ {
+ ErrorHandler errorHandler = feature.getErrorHandler();
+ Element xmlDOM = DOMUtils.sourceToElement(source);
+ new
SchemaValidationHelper(xsdURL).setErrorHandler(errorHandler).validateDocument(xmlDOM);
+ }
+ }
+ catch (RuntimeException rte)
+ {
+ throw rte;
+ }
+ catch (Exception ex)
+ {
+ WSException.rethrow(ex);
+ }
+ finally
+ {
+ schemaExtractor.close();
+ }
+ }
+
+ private boolean isValidationEnabled()
+ {
CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
if (msgContext != null)
- feature =
msgContext.getEndpointMetaData().getFeature(SchemaValidationFeature.class);
+ feature =
msgContext.getEndpointMetaData().getWebServiceFeature(SchemaValidationFeature.class);
- return feature != null && validated == false;
+ return feature != null ? feature.isEnabled() : false;
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContent.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContent.java 2008-02-29
18:59:14 UTC (rev 5872)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContent.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -39,15 +39,14 @@
OBJECT_VALID, XML_VALID, DOM_VALID
}
+ protected SOAPContentElement container;
+
abstract SOAPContent transitionTo(State nextState);
abstract State getState();
- protected SOAPContentElement container;
-
protected SOAPContent(SOAPContentElement container)
{
this.container = container;
}
-
}
Added:
stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java
(rev 0)
+++
stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -0,0 +1,90 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.ws.core.utils;
+
+// $Id$
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.jboss.ws.extensions.validation.ValidationErrorHandler;
+import org.jboss.wsf.common.DOMWriter;
+import org.w3c.dom.Element;
+import org.xml.sax.ErrorHandler;
+
+/**
+ * [JBWS-1172] Support schema validation for incoming messages
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 28-Feb-2008
+ */
+public class SchemaValidationHelper
+{
+ private URL xsdURL;
+ private ErrorHandler errorHandler = new ValidationErrorHandler();
+
+ public SchemaValidationHelper(URL xsdURL)
+ {
+ this.xsdURL = xsdURL;
+ }
+
+ public SchemaValidationHelper setErrorHandler(ErrorHandler errorHandler)
+ {
+ this.errorHandler = errorHandler;
+ return this;
+ }
+
+ public void validateDocument(String inxml) throws Exception
+ {
+ ByteArrayInputStream bais = new ByteArrayInputStream(inxml.getBytes());
+ validateDocument(bais);
+ }
+
+ public void validateDocument(Element inxml) throws Exception
+ {
+ String xmlStr = DOMWriter.printNode(inxml, false);
+ validateDocument(xmlStr);
+ }
+
+ public void validateDocument(InputStream inxml) throws Exception
+ {
+ DocumentBuilder builder = getDocumentBuilder();
+ builder.parse(inxml);
+ }
+
+ private DocumentBuilder getDocumentBuilder() throws ParserConfigurationException
+ {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ factory.setValidating(true);
+ factory.setNamespaceAware(true);
+
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
"http://www.w3.org/2001/XMLSchema");
+
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
xsdURL.toExternalForm());
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setErrorHandler(errorHandler);
+ return builder;
+ }
+}
Property changes on:
stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -49,6 +49,8 @@
// provide logging
private static Logger log = Logger.getLogger(SchemaExtractor.class);
+ private File xsdFile;
+
public URL getSchemaUrl(URL wsdlURL) throws IOException
{
// parse the wsdl
@@ -78,15 +80,24 @@
Element schemaElement = schemaElements.get(0);
File tmpdir = IOUtils.createTempDirectory();
- File tmpFile = File.createTempFile("jbossws_schema", ".xsd",
tmpdir);
- tmpFile.deleteOnExit();
+ xsdFile = File.createTempFile("jbossws_schema", ".xsd",
tmpdir);
+ xsdFile.deleteOnExit();
- OutputStreamWriter outwr = new OutputStreamWriter(new FileOutputStream(tmpFile));
+ OutputStreamWriter outwr = new OutputStreamWriter(new FileOutputStream(xsdFile));
DOMWriter domWriter = new DOMWriter(outwr);
domWriter.setPrettyprint(true);
domWriter.print(schemaElement);
outwr.close();
- return tmpFile.toURL();
+ return xsdFile.toURL();
}
+
+ public void close()
+ {
+ if (xsdFile != null)
+ {
+ xsdFile.delete();
+ xsdFile = null;
+ }
+ }
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -84,6 +84,7 @@
public SchemaValidationFeature(String schemaLocation)
{
this.schemaLocation = schemaLocation;
+ this.enabled = true;
}
/**
@@ -94,8 +95,8 @@
*/
public SchemaValidationFeature(boolean enabled, String schemaLocation)
{
+ this.schemaLocation = schemaLocation;
this.enabled = enabled;
- this.schemaLocation = schemaLocation;
}
/**
@@ -106,6 +107,16 @@
return ID;
}
+ public String getSchemaLocation()
+ {
+ return schemaLocation;
+ }
+
+ public void setSchemaLocation(String schemaLocation)
+ {
+ this.schemaLocation = schemaLocation;
+ }
+
public ErrorHandler getErrorHandler()
{
return errorHandler;
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSMetaDataBuilder.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -24,6 +24,7 @@
// $Id$
import java.io.File;
+import java.io.IOException;
import java.io.InputStream;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
@@ -59,6 +60,7 @@
import org.jboss.ws.Constants;
import org.jboss.ws.WSException;
import org.jboss.ws.annotation.Documentation;
+import org.jboss.ws.annotation.SchemaValidation;
import org.jboss.ws.core.jaxws.DynamicWrapperGenerator;
import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.jboss.ws.core.jaxws.WrapperGenerator;
@@ -70,7 +72,7 @@
import org.jboss.ws.extensions.addressing.metadata.AddressingOpMetaExt;
import org.jboss.ws.extensions.xop.jaxws.AttachmentScanResult;
import org.jboss.ws.extensions.xop.jaxws.ReflectiveAttachmentRefScanner;
-import org.jboss.ws.metadata.accessor.JAXBAccessor;
+import org.jboss.ws.feature.SchemaValidationFeature;
import org.jboss.ws.metadata.accessor.JAXBAccessorFactoryCreator;
import org.jboss.ws.metadata.builder.MetaDataBuilder;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
@@ -89,6 +91,8 @@
import org.jboss.ws.metadata.wsdl.WSDLMIMEPart;
import org.jboss.wsf.common.JavaUtils;
import org.jboss.wsf.spi.binding.BindingCustomization;
+import org.jboss.wsf.spi.deployment.ArchiveDeployment;
+import org.jboss.wsf.spi.deployment.Deployment;
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.HandlerChainsObjectFactory;
import org.jboss.wsf.spi.metadata.j2ee.serviceref.UnifiedHandlerChainMetaData;
@@ -98,6 +102,7 @@
import org.jboss.xb.binding.ObjectModelFactory;
import org.jboss.xb.binding.Unmarshaller;
import org.jboss.xb.binding.UnmarshallerFactory;
+import org.xml.sax.ErrorHandler;
import com.sun.xml.bind.api.JAXBRIContext;
import com.sun.xml.bind.api.TypeReference;
@@ -1035,4 +1040,46 @@
{
this.wrapperGenerator = wrapperGenerator;
}
+
+ protected void processWebServiceFeatures(Deployment dep, ServerEndpointMetaData
sepMetaData, Class<?> sepClass)
+ {
+ if (sepClass.isAnnotationPresent(SchemaValidation.class))
+ {
+ SchemaValidation anValidation = sepClass.getAnnotation(SchemaValidation.class);
+ SchemaValidationFeature feature = new SchemaValidationFeature();
+
+ String xsdLoc = anValidation.schemaLocation();
+ if (xsdLoc.length() > 0)
+ {
+ if (dep instanceof ArchiveDeployment)
+ {
+ try
+ {
+ URL xsdURL = ((ArchiveDeployment)dep).getMetaDataFileURL(xsdLoc);
+ xsdLoc = xsdURL.toExternalForm();
+ }
+ catch (IOException ex)
+ {
+ throw new WSException("Cannot load schema: " + xsdLoc, ex);
+ }
+ }
+ feature.setSchemaLocation(xsdLoc);
+ }
+
+ Class handlerClass = anValidation.errorHandler();
+ if (handlerClass != null)
+ {
+ try
+ {
+ ErrorHandler errorHandler = (ErrorHandler)handlerClass.newInstance();
+ feature.setErrorHandler(errorHandler);
+ }
+ catch (Exception ex)
+ {
+ throw new WSException("Cannot instanciate error handler: " +
handlerClass, ex);
+ }
+ }
+ sepMetaData.addWebServiceFeature(feature);
+ }
+ }
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/builder/jaxws/JAXWSWebServiceMetaDataBuilder.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -112,6 +112,7 @@
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime loader cannot be
null");
+
resetMetaDataBuilder(runtimeClassLoader);
ServerEndpointMetaData sepMetaData = result.sepMetaData;
@@ -137,6 +138,9 @@
// process config
processEndpointConfig(dep, sepMetaData, sepClass, linkName);
+ // process web service features
+ processWebServiceFeatures(dep, sepMetaData, sepClass);
+
// Process endpoint documentation
if (seiClass.isAnnotationPresent(Documentation.class))
sepMetaData.setDocumentation(seiClass.getAnnotation(Documentation.class).content());
@@ -209,7 +213,8 @@
}
catch (Exception ex)
{
- throw new WSException("Cannot build meta data: " + ex.getMessage(),
ex);
+ WSException.rethrow("Cannot build meta data: " + ex.getMessage(),
ex);
+ return null;
}
}
@@ -321,6 +326,7 @@
ClassLoader runtimeClassLoader = dep.getRuntimeClassLoader();
if(null == runtimeClassLoader)
throw new IllegalArgumentException("Runtime loader cannot be
null");
+
seiClass = runtimeClassLoader.loadClass(seiName);
WebService seiAnnotation = seiClass.getAnnotation(WebService.class);
@@ -340,8 +346,8 @@
interfaceNS = wsdlUtils.getTypeNamespace(seiClass);
// The spec states that WSDL location should be allowed on an SEI, although it
- // makes far more sense on the implementation bean, so we ALWAYS override the
SEI
- // when wsdlLocation is defined on the bean
+ // makes far more sense on the implementation bean, so we ONLY consider the SEI
+ // wsdlLocation when it is not defined on the bean already
if (wsdlLocation.length() == 0)
wsdlLocation = seiAnnotation.wsdlLocation();
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -363,23 +363,28 @@
this.properties = properties;
}
- public <T extends WebServiceFeature> T getFeature(Class<T> key)
+ public <T extends WebServiceFeature> T getWebServiceFeature(Class<T> key)
{
for (WebServiceFeature feature : features)
{
- if (key.isAssignableFrom(feature.getClass()))
+ if (key == feature.getClass())
return (T)feature;
}
return null;
}
- public Set<WebServiceFeature> getFeatures()
+ public Set<WebServiceFeature> getWebServiceFeatures()
{
return features;
}
- public void setFeatures(Set<WebServiceFeature> features)
+ public void addWebServiceFeature(WebServiceFeature feature)
{
+ this.features.add(feature);
+ }
+
+ public void setWebServiceFeatures(Set<WebServiceFeature> features)
+ {
this.features = features;
}
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java
===================================================================
---
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ServiceMetaData.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -279,6 +279,28 @@
*/
public WSDLDefinitions getWsdlDefinitions()
{
+ WSDLDefinitions wsdlDefinitions = null;
+
+ URL wsdlURL = getWsdlFileOrLocation();
+ if (wsdlURL != null)
+ {
+ // The key should not after it is assigned
+ if (wsdlCacheKey == null)
+ wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation :
wsdlFile);
+
+ wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
+ if (wsdlDefinitions == null)
+ {
+ WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+ wsdlDefinitions = factory.parse(wsdlURL);
+ wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
+ }
+ }
+ return wsdlDefinitions;
+ }
+
+ public URL getWsdlFileOrLocation()
+ {
URL wsdlURL = wsdlLocation;
if (wsdlURL == null && wsdlFile != null)
{
@@ -306,23 +328,7 @@
}
}
}
-
- WSDLDefinitions wsdlDefinitions = null;
- if (wsdlURL != null)
- {
- // The key should not after it is assigned
- if (wsdlCacheKey == null)
- wsdlCacheKey = "#" + (wsdlLocation != null ? wsdlLocation :
wsdlFile);
-
- wsdlDefinitions = (WSDLDefinitions)wsMetaData.getWsdlDefinition(wsdlCacheKey);
- if (wsdlDefinitions == null)
- {
- WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
- wsdlDefinitions = factory.parse(wsdlURL);
- wsMetaData.addWsdlDefinition(wsdlCacheKey, wsdlDefinitions);
- }
- }
- return wsdlDefinitions;
+ return wsdlURL;
}
public TypeMappingImpl getTypeMapping()
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -21,26 +21,26 @@
*/
package org.jboss.test.ws.jaxws.jbws1172;
-import java.io.ByteArrayInputStream;
import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.net.URL;
import javax.xml.namespace.QName;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.ws.Service;
import javax.xml.ws.Service21;
import junit.framework.Test;
import org.jboss.test.ws.jaxws.jbws1172.types.MyTest;
+import org.jboss.ws.core.utils.SchemaValidationHelper;
import org.jboss.ws.extensions.validation.SchemaExtractor;
-import org.jboss.ws.extensions.validation.ValidationErrorHandler;
import org.jboss.ws.feature.SchemaValidationFeature;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
+import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
/**
* [JBWS-1172] Support schema validation for incoming messages
@@ -52,6 +52,8 @@
*/
public class JBWS1172TestCase extends JBossWSTest
{
+ private static final QName SERVICE_NAME = new
QName("http://www.my-company.it/ws/my-test", "MyTestService");
+
public static Test suite()
{
return new JBossWSTestSetup(JBWS1172TestCase.class,
"jaxws-jbws1172.war");
@@ -59,18 +61,20 @@
public void testSchemaValidationPositive() throws Exception
{
- URL xsdURL = new
File("resources/jaxws/jbws1172/TestService.xsd").toURL();
+ URL wsdlURL = new
File("resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl").toURL();
+ URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
String inxml = "<performTest
xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
- parseDocument(inxml, xsdURL);
+ new SchemaValidationHelper(xsdURL).validateDocument(inxml);
}
public void testSchemaValidationNegative() throws Exception
{
- URL xsdURL = new
File("resources/jaxws/jbws1172/TestService.xsd").toURL();
+ URL wsdlURL = new
File("resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl").toURL();
+ URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
String inxml = "<performTest
xmlns='http://www.my-company.it/ws/my-test'><Code>2000</Code></performTest>";
try
{
- parseDocument(inxml, xsdURL);
+ new SchemaValidationHelper(xsdURL).validateDocument(inxml);
}
catch (SAXException ex)
{
@@ -79,57 +83,97 @@
}
}
- public void testSchemaExtractor() throws Exception
+ public void testEndpointWsdlValidation() throws Exception
{
- URL wsdlURL = new
File("resources/jaxws/jbws1172/TestService.wsdl").toURL();
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172/noval?wsdl");
URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
String inxml = "<performTest
xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
- parseDocument(inxml, xsdURL);
+ new SchemaValidationHelper(xsdURL).validateDocument(inxml);
}
-
- public void testEndpointWsdlValidation() throws Exception
+
+ public void testValidatingClientWithExplicitSchema() throws Exception
{
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172?wsdl");
+ URL wsdlURL = new
File("resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl").toURL();
URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
- String inxml = "<performTest
xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
- parseDocument(inxml, xsdURL);
+
+ Service21 service = Service21.create(wsdlURL, SERVICE_NAME);
+ SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+ MyTest port = service.getPort(MyTest.class, feature);
+ try
+ {
+ port.performTest(new Long(2000));
+ }
+ catch (Exception ex)
+ {
+ StringWriter stwr = new StringWriter();
+ ex.printStackTrace(new PrintWriter(stwr));
+ String msg = stwr.toString();
+ assertTrue("Unexpectd message: " + ex.getMessage(),
msg.indexOf("Value '2000' is not facet-valid with respect to maxInclusive
'1000'") > 0);
+ }
}
- public void testNonValidatingClient() throws Exception
+ public void testValidatingClientWithErrorHandler() throws Exception
{
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172?wsdl");
- QName serviceName = new QName("http://www.my-company.it/ws/my-test",
"MyTestService");
- Service service = Service.create(wsdlURL, serviceName);
+ URL wsdlURL = new
File("resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl").toURL();
+ URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
+
+ Service21 service = Service21.create(wsdlURL, SERVICE_NAME);
+ SchemaValidationFeature feature = new SchemaValidationFeature(xsdURL.toString());
+
+ TestErrorHandler errorHandler = new TestErrorHandler();
+ feature.setErrorHandler(errorHandler);
+
+ MyTest port = service.getPort(MyTest.class, feature);
+ port.performTest(new Long(2000));
+
+ String msg = errorHandler.getErrors();
+ assertTrue("Unexpectd message: " + msg, msg.indexOf("Value
'2000' is not facet-valid with respect to maxInclusive '1000'") >
0);
+ }
+
+ public void testNonValidatingEndpoint() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172/noval?wsdl");
+
+ Service service = Service.create(wsdlURL, SERVICE_NAME);
MyTest port = service.getPort(MyTest.class);
port.performTest(new Long(1000));
+ port.performTest(new Long(2000));
}
- public void testValidatingClientWithExplicitSchema() throws Exception
+ public void testValidatingEndpoint() throws Exception
{
- URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172?wsdl");
- URL xsdURL = new SchemaExtractor().getSchemaUrl(wsdlURL);
- QName serviceName = new QName("http://www.my-company.it/ws/my-test",
"MyTestService");
- Service21 service = Service21.create(wsdlURL, serviceName);
- MyTest port = service.getPort(MyTest.class, new
SchemaValidationFeature(xsdURL.toString()));
+ URL wsdlURL = new URL("http://" + getServerHost() +
":8080/jaxws-jbws1172/doval?wsdl");
+
+ Service service = Service.create(wsdlURL, SERVICE_NAME);
+ MyTest port = service.getPort(MyTest.class);
port.performTest(new Long(1000));
- }
+ try
+ {
+ port.performTest(new Long(2000));
+ }
+ catch (Exception ex)
+ {
+ String msg = ex.getMessage();
+ assertTrue("Unexpectd message: " + ex.getMessage(),
msg.indexOf("Value '2000' is not facet-valid with respect to maxInclusive
'1000'") > 0);
+ }
+}
- private void parseDocument(String inxml, URL xsdURL) throws Exception
+ private static class TestErrorHandler implements ErrorHandler
{
- DocumentBuilder builder = getDocumentBuilder(xsdURL);
- ByteArrayInputStream bais = new ByteArrayInputStream(inxml.getBytes());
- builder.parse(bais);
+ private StringBuilder errors = new StringBuilder();
+ public String getErrors()
+ {
+ return errors.toString();
+ }
+ public void error(SAXParseException ex) throws SAXException
+ {
+ errors.append(ex.getMessage());
+ }
+ public void fatalError(SAXParseException ex) throws SAXException
+ {
+ }
+ public void warning(SAXParseException ex) throws SAXException
+ {
+ }
}
-
- private DocumentBuilder getDocumentBuilder(URL xsdURL) throws
ParserConfigurationException
- {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setValidating(true);
- factory.setNamespaceAware(true);
-
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
"http://www.w3.org/2001/XMLSchema");
-
factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schema...;,
xsdURL.toExternalForm());
- DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setErrorHandler(new ValidationErrorHandler());
- return builder;
- }
}
Deleted:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java 2008-02-29
18:59:14 UTC (rev 5872)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -1,19 +0,0 @@
-package org.jboss.test.ws.jaxws.jbws1172;
-
-import javax.jws.WebService;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.annotation.EndpointConfig;
-
-@WebService(serviceName="MyTestService",
targetNamespace="http://www.my-company.it/ws/my-test", endpointInterface =
"org.jboss.test.ws.jaxws.jbws1172.types.MyTest")
-@EndpointConfig
-public class MyTestImpl
-{
- // provide logging
- private static Logger log = Logger.getLogger(MyTestImpl.class);
-
- public void performTest(Long code)
- {
- log.info(code);
- }
-}
Copied:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/NonValidatingEndpoint.java
(from rev 5869,
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java)
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/NonValidatingEndpoint.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/NonValidatingEndpoint.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -0,0 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1172;
+
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+
+@WebService(serviceName = "MyTestService",
+ targetNamespace = "http://www.my-company.it/ws/my-test",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws1172.types.MyTest")
+
+public class NonValidatingEndpoint
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(NonValidatingEndpoint.class);
+
+ public void performTest(Long code)
+ {
+ log.info(code);
+ }
+}
Added:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.java
===================================================================
---
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.java
(rev 0)
+++
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.java 2008-02-29
20:13:20 UTC (rev 5873)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jboss.test.ws.jaxws.jbws1172;
+
+import javax.jws.WebService;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.annotation.SchemaValidation;
+
+@WebService(serviceName = "MyTestService", portName = "MyTestPort",
+ targetNamespace = "http://www.my-company.it/ws/my-test",
+ endpointInterface = "org.jboss.test.ws.jaxws.jbws1172.types.MyTest",
+ wsdlLocation = "WEB-INF/wsdl/TestService.wsdl")
+
+@SchemaValidation
+public class ValidatingEndpoint
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ValidatingEndpoint.class);
+
+ public void performTest(Long code)
+ {
+ log.info(code);
+ }
+}
Property changes on:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/ValidatingEndpoint.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Deleted: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl 2008-02-29
18:59:14 UTC (rev 5872)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl 2008-02-29
20:13:20 UTC (rev 5873)
@@ -1,65 +0,0 @@
-<definitions name="MyTestService"
targetNamespace="http://www.my-company.it/ws/my-test"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.my-company.it/ws/my-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <types>
- <schema elementFormDefault="qualified"
targetNamespace="http://www.my-company.it/ws/my-test"
xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.my-company.it/ws/my-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <complexType name="MyWSException">
- <sequence>
- <element name="message" nillable="true"
type="string"/>
- </sequence>
- </complexType>
- <complexType name="performTest">
- <sequence>
- <element name="Code" nillable="true"
type="tns:CodeType"/>
- </sequence>
- </complexType>
- <complexType name="performTestResponse">
- <sequence/>
- </complexType>
- <simpleType name="CodeType">
- <restriction base="integer">
- <minInclusive value="0"/>
- <maxInclusive value="1000"/>
- </restriction>
- </simpleType>
- <element name="MyWSException" type="tns:MyWSException"/>
- <element name="performTest" type="tns:performTest"/>
- <element name="performTestResponse"
type="tns:performTestResponse"/>
- </schema>
- </types>
- <message name="MyTest_performTestResponse">
- <part element="tns:performTestResponse" name="result"/>
- </message>
- <message name="MyTest_performTest">
- <part element="tns:performTest" name="parameters"/>
- </message>
- <message name="MyWSException">
- <part element="tns:MyWSException" name="MyWSException"/>
- </message>
- <portType name="MyTest">
- <operation name="performTest">
- <input message="tns:MyTest_performTest"/>
- <output message="tns:MyTest_performTestResponse"/>
- <fault message="tns:MyWSException" name="MyWSException"/>
- </operation>
- </portType>
- <binding name="MyTestBinding" type="tns:MyTest">
- <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
- <operation name="performTest">
- <soap:operation soapAction="urn:performTest"/>
- <input>
- <soap:body use="literal"/>
- </input>
- <output>
- <soap:body use="literal"/>
- </output>
- <fault name="MyWSException">
- <soap:fault name="MyWSException" use="literal"/>
- </fault>
- </operation>
- </binding>
- <service name="MyTestService">
- <port binding="tns:MyTestBinding" name="MyTestPort">
- <soap:address
location="http://my-company.it/my-context/my-endpoint"/>
- </port>
- </service>
-</definitions>
\ No newline at end of file
Deleted: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd 2008-02-29
18:59:14 UTC (rev 5872)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd 2008-02-29
20:13:20 UTC (rev 5873)
@@ -1,25 +0,0 @@
-<schema elementFormDefault="qualified"
targetNamespace="http://www.my-company.it/ws/my-test"
xmlns="http://www.w3.org/2001/XMLSchema"
- xmlns:tns="http://www.my-company.it/ws/my-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <complexType name="MyWSException">
- <sequence>
- <element name="message" nillable="true"
type="string"/>
- </sequence>
- </complexType>
- <complexType name="performTest">
- <sequence>
- <element name="Code" nillable="true"
type="tns:CodeType"/>
- </sequence>
- </complexType>
- <complexType name="performTestResponse">
- <sequence/>
- </complexType>
- <simpleType name="CodeType">
- <restriction base="integer">
- <minInclusive value="0"/>
- <maxInclusive value="1000"/>
- </restriction>
- </simpleType>
- <element name="MyWSException" type="tns:MyWSException"/>
- <element name="performTest" type="tns:performTest"/>
- <element name="performTestResponse"
type="tns:performTestResponse"/>
-</schema>
Modified: stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml 2008-02-29
18:59:14 UTC (rev 5872)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml 2008-02-29
20:13:20 UTC (rev 5873)
@@ -4,12 +4,22 @@
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<servlet>
- <servlet-name>TestEndpoint</servlet-name>
-
<servlet-class>org.jboss.test.ws.jaxws.jbws1172.MyTestImpl</servlet-class>
+ <servlet-name>NonValidatingEndpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws1172.NonValidatingEndpoint</servlet-class>
</servlet>
+ <servlet>
+ <servlet-name>ValidatingEndpoint</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws1172.ValidatingEndpoint</servlet-class>
+ </servlet>
+
<servlet-mapping>
- <servlet-name>TestEndpoint</servlet-name>
- <url-pattern>/*</url-pattern>
+ <servlet-name>NonValidatingEndpoint</servlet-name>
+ <url-pattern>/noval</url-pattern>
</servlet-mapping>
+
+ <servlet-mapping>
+ <servlet-name>ValidatingEndpoint</servlet-name>
+ <url-pattern>/doval</url-pattern>
+ </servlet-mapping>
</web-app>
\ No newline at end of file
Copied: stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl
(from rev 5869, stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl)
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl
(rev 0)
+++
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/wsdl/TestService.wsdl 2008-02-29
20:13:20 UTC (rev 5873)
@@ -0,0 +1,65 @@
+<definitions name="MyTestService"
targetNamespace="http://www.my-company.it/ws/my-test"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.my-company.it/ws/my-test"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+ <types>
+ <schema elementFormDefault="qualified"
targetNamespace="http://www.my-company.it/ws/my-test"
xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:tns="http://www.my-company.it/ws/my-test"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <complexType name="MyWSException">
+ <sequence>
+ <element name="message" nillable="true"
type="string"/>
+ </sequence>
+ </complexType>
+ <complexType name="performTest">
+ <sequence>
+ <element name="Code" nillable="true"
type="tns:CodeType"/>
+ </sequence>
+ </complexType>
+ <complexType name="performTestResponse">
+ <sequence/>
+ </complexType>
+ <simpleType name="CodeType">
+ <restriction base="integer">
+ <minInclusive value="0"/>
+ <maxInclusive value="1000"/>
+ </restriction>
+ </simpleType>
+ <element name="MyWSException" type="tns:MyWSException"/>
+ <element name="performTest" type="tns:performTest"/>
+ <element name="performTestResponse"
type="tns:performTestResponse"/>
+ </schema>
+ </types>
+ <message name="MyTest_performTestResponse">
+ <part element="tns:performTestResponse" name="result"/>
+ </message>
+ <message name="MyTest_performTest">
+ <part element="tns:performTest" name="parameters"/>
+ </message>
+ <message name="MyWSException">
+ <part element="tns:MyWSException" name="MyWSException"/>
+ </message>
+ <portType name="MyTest">
+ <operation name="performTest">
+ <input message="tns:MyTest_performTest"/>
+ <output message="tns:MyTest_performTestResponse"/>
+ <fault message="tns:MyWSException" name="MyWSException"/>
+ </operation>
+ </portType>
+ <binding name="MyTestBinding" type="tns:MyTest">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name="performTest">
+ <soap:operation soapAction="urn:performTest"/>
+ <input>
+ <soap:body use="literal"/>
+ </input>
+ <output>
+ <soap:body use="literal"/>
+ </output>
+ <fault name="MyWSException">
+ <soap:fault name="MyWSException" use="literal"/>
+ </fault>
+ </operation>
+ </binding>
+ <service name="MyTestService">
+ <port binding="tns:MyTestBinding" name="MyTestPort">
+ <soap:address
location="http://@jboss.bind.address@:8080/jaxws-jbws1172/noval"/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file