JBossWS SVN: r5874 - in stack/native/trunk/src: main/java/org/jboss/ws/core/soap and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 15:30:31 -0500 (Fri, 29 Feb 2008)
New Revision: 5874
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/LoggingErrorHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/StrictlyValidErrorHandler.java
Removed:
stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
Log:
[JBWS-1172] Support schema validation for incoming/outgoing messages
Modified: stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java 2008-02-29 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/main/java/org/jboss/ws/annotation/SchemaValidation.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -28,7 +28,7 @@
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
-import org.jboss.ws.extensions.validation.ValidationErrorHandler;
+import org.jboss.ws.extensions.validation.StrictlyValidErrorHandler;
/**
* This feature represents the use of schema validation with a
@@ -53,5 +53,5 @@
* Optional property for the error handler.
* If this is not specified the @{ValidationErrorHandler} will be used.
*/
- Class errorHandler() default ValidationErrorHandler.class;
+ Class errorHandler() default StrictlyValidErrorHandler.class;
}
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 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -32,8 +32,8 @@
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.extensions.validation.SchemaValidationHelper;
import org.jboss.ws.feature.SchemaValidationFeature;
import org.jboss.ws.metadata.umdm.EndpointMetaData;
import org.jboss.wsf.common.DOMUtils;
Deleted: 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 2008-02-29 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -1,90 +0,0 @@
-/*
- * 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/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
- DocumentBuilder builder = factory.newDocumentBuilder();
- builder.setErrorHandler(errorHandler);
- return builder;
- }
-}
Added: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/LoggingErrorHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/LoggingErrorHandler.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/LoggingErrorHandler.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -0,0 +1,56 @@
+/*
+ * 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.extensions.validation;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * An error handler that logs a @{SAXException} on error.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+public class LoggingErrorHandler implements ErrorHandler
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(LoggingErrorHandler.class);
+
+ public void error(SAXParseException ex) throws SAXException
+ {
+ log.error(ex.toString());
+ }
+
+ public void fatalError(SAXParseException ex) throws SAXException
+ {
+ log.fatal(ex.toString());
+ }
+
+ public void warning(SAXParseException ex) throws SAXException
+ {
+ log.warn(ex.toString());
+ }
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/LoggingErrorHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Copied: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java (from rev 5873, stack/native/trunk/src/main/java/org/jboss/ws/core/utils/SchemaValidationHelper.java)
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaValidationHelper.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -0,0 +1,89 @@
+/*
+ * 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.extensions.validation;
+
+// $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.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 StrictlyValidErrorHandler();
+
+ 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/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setErrorHandler(errorHandler);
+ return builder;
+ }
+}
Copied: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/StrictlyValidErrorHandler.java (from rev 5869, stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java)
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/StrictlyValidErrorHandler.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/StrictlyValidErrorHandler.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -0,0 +1,58 @@
+/*
+ * 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.extensions.validation;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * An error handler that throws a @{SAXException} on error and fatal error.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+public class StrictlyValidErrorHandler implements ErrorHandler
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(StrictlyValidErrorHandler.class);
+
+ public void error(SAXParseException ex) throws SAXException
+ {
+ log.error(ex.toString());
+ throw new SAXException(ex.getMessage());
+ }
+
+ public void fatalError(SAXParseException ex) throws SAXException
+ {
+ log.fatal(ex.toString());
+ throw new SAXException(ex.getMessage());
+ }
+
+ public void warning(SAXParseException ex) throws SAXException
+ {
+ log.warn(ex.toString());
+ }
+}
Deleted: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java 2008-02-29 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -1,58 +0,0 @@
-/*
- * 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.extensions.validation;
-
-//$Id$
-
-import org.jboss.logging.Logger;
-import org.xml.sax.ErrorHandler;
-import org.xml.sax.SAXException;
-import org.xml.sax.SAXParseException;
-
-/**
- * Extracts the schema from a given WSDL
- *
- * @author Thomas.Diesler(a)jboss.com
- * @since 29-Feb-2008
- */
-public class ValidationErrorHandler implements ErrorHandler
-{
- // provide logging
- private static Logger log = Logger.getLogger(ValidationErrorHandler.class);
-
- public void error(SAXParseException ex) throws SAXException
- {
- log.error(ex.toString());
- throw new SAXException(ex.getMessage());
- }
-
- public void fatalError(SAXParseException ex) throws SAXException
- {
- log.fatal(ex.toString());
- throw new SAXException(ex.getMessage());
- }
-
- public void warning(SAXParseException ex) throws SAXException
- {
- log.warn(ex.toString());
- }
-}
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 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -26,7 +26,7 @@
import javax.xml.ws.WebServiceFeature;
import org.jboss.ws.Constants;
-import org.jboss.ws.extensions.validation.ValidationErrorHandler;
+import org.jboss.ws.extensions.validation.StrictlyValidErrorHandler;
import org.xml.sax.ErrorHandler;
/**
@@ -55,7 +55,7 @@
* Optional property for the error handler.
* If this is not specified the @{ValidationErrorHandler} will be used.
*/
- protected ErrorHandler errorHandler = new ValidationErrorHandler();
+ protected ErrorHandler errorHandler = new StrictlyValidErrorHandler();
/**
* Create an <code>SchemaValidationFeature</code>.
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 20:13:20 UTC (rev 5873)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2008-02-29 20:30:31 UTC (rev 5874)
@@ -33,8 +33,8 @@
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.SchemaValidationHelper;
import org.jboss.ws.feature.SchemaValidationFeature;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
16 years, 9 months
JBossWS SVN: r5873 - in stack/native/trunk: src/main/java/org/jboss/ws/annotation and 11 other directories.
by jbossws-commits@lists.jboss.org
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/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", 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/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
- factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", 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
16 years, 9 months
JBossWS SVN: r5872 - in stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport: backchannel and 1 other directory.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-02-29 13:59:14 -0500 (Fri, 29 Feb 2008)
New Revision: 5872
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java
Log:
remoting hack
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java 2008-02-29 17:37:42 UTC (rev 5871)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/RMChannelTask.java 2008-02-29 18:59:14 UTC (rev 5872)
@@ -27,6 +27,7 @@
import java.util.concurrent.Callable;
import org.jboss.logging.Logger;
+import org.jboss.remoting.CannotConnectException;
import org.jboss.remoting.Client;
import org.jboss.remoting.InvokerLocator;
import org.jboss.remoting.marshal.MarshalFactory;
@@ -102,7 +103,19 @@
}
else
{
- Object retVal = client.invoke(rmRequest.getPayload(), remotingInvocationContext);
+ Object retVal = null;
+ try
+ {
+ retVal = client.invoke(rmRequest.getPayload(), remotingInvocationContext);
+ }
+ catch (CannotConnectException cce)
+ {
+ // remoting hack - ignore NullPointerException cause
+ if (false == (cce.getCause() instanceof NullPointerException))
+ {
+ throw cce;
+ }
+ }
if ((null != retVal) && (false == (retVal instanceof RMMessage)))
{
String msg = retVal.getClass().getName() + ": '" + retVal + "'";
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java 2008-02-29 17:37:42 UTC (rev 5871)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/transport/backchannel/RMCallbackHandlerImpl.java 2008-02-29 18:59:14 UTC (rev 5872)
@@ -28,7 +28,6 @@
import org.jboss.logging.Logger;
import org.jboss.remoting.InvocationRequest;
-import org.jboss.remoting.transport.coyote.RequestMap;
import org.jboss.ws.core.MessageTrace;
import org.jboss.ws.extensions.wsrm.transport.RMMessage;
import org.jboss.ws.extensions.wsrm.transport.RMUnassignedMessageListener;
16 years, 9 months
JBossWS SVN: r5871 - in stack/native/trunk/src/main/java/org/jboss/ws: core/jaxws/client and 2 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-02-29 12:37:42 -0500 (Fri, 29 Feb 2008)
New Revision: 5871
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/core/MessageTrace.java
stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
Log:
fixing message no. inconsistency
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/MessageTrace.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/MessageTrace.java 2008-02-29 16:35:57 UTC (rev 5870)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/MessageTrace.java 2008-02-29 17:37:42 UTC (rev 5871)
@@ -85,6 +85,12 @@
String xmlString = DOMWriter.printNode(root, true);
msgLog.trace(messagePrefix + "\n" + xmlString);
}
+ else if (message instanceof String)
+ {
+ Element root = new XMLFragment(new StreamSource(new ByteArrayInputStream(((String)message).getBytes()))).toElement();
+ String xmlString = DOMWriter.printNode(root, true);
+ msgLog.trace(messagePrefix + "\n" + xmlString);
+ }
else
{
msgLog.warn("Unsupported message type: " + message);
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2008-02-29 16:35:57 UTC (rev 5870)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/client/ClientImpl.java 2008-02-29 17:37:42 UTC (rev 5871)
@@ -281,6 +281,7 @@
}
Map<String, Object> rmRequestContext = new HashMap<String, Object>();
List<QName> outMsgs = new LinkedList<QName>();
+ wsrmSequence.newMessageNumber();
outMsgs.add(RMProvider.get().getConstants().getSequenceQName());
outMsgs.add(RMProvider.get().getConstants().getAckRequestedQName());
if (wsrmSequence.isAckRequested())
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java 2008-02-29 16:35:57 UTC (rev 5870)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/jaxws/RMHandlerHelper.java 2008-02-29 17:37:42 UTC (rev 5871)
@@ -262,7 +262,7 @@
// construct Sequence object
org.jboss.ws.extensions.wsrm.spi.protocol.RMSequence sequence = rmFactory.newSequence();
sequence.setIdentifier(seq.getOutboundId());
- sequence.setMessageNumber(seq.newMessageNumber());
+ sequence.setMessageNumber(seq.getLastMessageNumber());
return sequence;
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-29 16:35:57 UTC (rev 5870)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-29 17:37:42 UTC (rev 5871)
@@ -217,8 +217,7 @@
throw getUnknownSequenceFault(seqIdentifier);
}
- RMStore.serialize(dataDir, sequence); // TODO: serialization of terminated sequence results in no file
- //sequences.remove(sequence);
+ RMStore.serialize(dataDir, sequence);
if (RMProvider.get().getMessageFactory().newTerminateSequenceResponse() != null)
{
protocolMessages.add(rmConstants.getTerminateSequenceResponseQName());
@@ -257,6 +256,14 @@
boolean retTypeIsVoid = inv.getJavaMethod().getReturnType().equals(Void.class) || inv.getJavaMethod().getReturnType().equals(Void.TYPE);
if (false == retTypeIsVoid)
{
+ try
+ {
+ sequence.newMessageNumber();
+ }
+ finally
+ {
+ RMStore.serialize(dataDir, sequence);
+ }
protocolMessages.add(rmConstants.getSequenceQName());
protocolMessages.add(rmConstants.getAckRequestedQName());
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2008-02-29 16:35:57 UTC (rev 5870)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMServerSequence.java 2008-02-29 17:37:42 UTC (rev 5871)
@@ -169,6 +169,7 @@
{
if (this.messageNumber == Long.MAX_VALUE)
{
+ this.terminate();
Map<String, Object> detailsMap = new HashMap<String, Object>(3);
detailsMap.put(RMFaultConstant.IDENTIFIER, this.outboundId);
detailsMap.put(RMFaultConstant.MAX_MESSAGE_NUMBER, this.messageNumber);
16 years, 9 months
JBossWS SVN: r5870 - stack/native/trunk/ant-import.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 11:35:57 -0500 (Fri, 29 Feb 2008)
New Revision: 5870
Modified:
stack/native/trunk/ant-import/build-setup.xml
stack/native/trunk/ant-import/build-thirdparty.xml
Log:
Enforce container specific libraries (jbossxb,remoting)
Modified: stack/native/trunk/ant-import/build-setup.xml
===================================================================
--- stack/native/trunk/ant-import/build-setup.xml 2008-02-29 15:02:05 UTC (rev 5869)
+++ stack/native/trunk/ant-import/build-setup.xml 2008-02-29 16:35:57 UTC (rev 5870)
@@ -84,37 +84,6 @@
</or>
</condition>
- <!-- switch jbossxb dependening on container -->
- <condition property="container-dependent.jbossxb.version" value="${jboss-jbossxb-jboss42}">
- <or>
- <equals arg1="${jbossws.integration.target}" arg2="jboss421"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss422"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss423"/>
- </or>
- </condition>
- <condition property="container-dependent.jbossxb.version" value="${jboss-jbossxb-jboss50}">
- <or>
- <equals arg1="${jbossws.integration.target}" arg2="jboss500"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss501"/>
- </or>
- </condition>
-
- <!-- switch remoting dependening on container -->
- <condition property="container-dependent.remoting.version" value="${jboss-remoting-jboss42}">
- <or>
- <equals arg1="${jbossws.integration.target}" arg2="jboss421"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss422"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss423"/>
- </or>
- </condition>
- <condition property="container-dependent.remoting.version" value="${jboss-remoting-jboss50}">
- <or>
- <equals arg1="${jbossws.integration.target}" arg2="jboss500"/>
- <equals arg1="${jbossws.integration.target}" arg2="jboss501"/>
- </or>
- </condition>
-
-
<available property="jbossws.portal.content.available" file="${jbossws.portal.content}" type="dir"/>
<!-- JDK Detection -->
Modified: stack/native/trunk/ant-import/build-thirdparty.xml
===================================================================
--- stack/native/trunk/ant-import/build-thirdparty.xml 2008-02-29 15:02:05 UTC (rev 5869)
+++ stack/native/trunk/ant-import/build-thirdparty.xml 2008-02-29 16:35:57 UTC (rev 5870)
@@ -44,9 +44,14 @@
<target name="thirdparty-get" depends="thirdparty-init" if="force.thirdparty"
description="Gets the thirdparty libraries">
- <echo>JBossXB: ${container-dependent.jbossxb.version}</echo>
- <echo>Remoting: ${container-dependent.remoting.version}</echo>
-
+ <!--
+ Note, the jboss-xml-binding and jboss-remoting jars are downloaded in the versions that are actually deployed.
+ Currently only jboss-xml-binding is deployed. Remoting should be downloaded in the version of the oldest supported target container.
+
+ It is a mistake to switch the download version dependent on the target container,
+ in which case it is random which version is used by the deploy targets.
+ -->
+
<mkdir dir="${thirdparty.dir}"/>
<get src="${jboss.repository}/junit/${junit}/lib/junit.jar" dest="${thirdparty.dir}/junit.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/jbossws-common/${jbossws-common}/lib/jbossws-common.jar" dest="${thirdparty.dir}/jbossws-common.jar" usetimestamp="true" verbose="true"/>
@@ -85,8 +90,8 @@
<get src="${jboss.repository}/jboss/jboss-javaee/${jboss-javaee}/lib/jboss-javaee.jar" dest="${thirdparty.dir}/jboss-javaee.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs.jar" dest="${thirdparty.dir}/jboss-vfs.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/jboss-vfs/${jboss-vfs}/lib/jboss-vfs-sources.jar" dest="${thirdparty.dir}/jboss-vfs-sources.jar" usetimestamp="true" verbose="true"/>
- <get src="${jboss.repository}/jboss/jbossxb/${container-dependent.jbossxb.version}/lib/jboss-xml-binding.jar" dest="${thirdparty.dir}/jboss-xml-binding.jar" usetimestamp="true" verbose="true"/>
- <get src="${jboss.repository}/jboss/jbossxb/${container-dependent.jbossxb.version}/lib/jboss-xml-binding-sources.jar" dest="${thirdparty.dir}/jboss-xml-binding-sources.jar" usetimestamp="true" verbose="true"/>
+ <get src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb-jboss42}/lib/jboss-xml-binding.jar" dest="${thirdparty.dir}/jboss-xml-binding.jar" usetimestamp="true" verbose="true"/>
+ <get src="${jboss.repository}/jboss/jbossxb/${jboss-jbossxb-jboss42}/lib/jboss-xml-binding-sources.jar" dest="${thirdparty.dir}/jboss-xml-binding-sources.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/jaxbintros/${jaxbintros}/lib/jboss-jaxb-intros.jar" dest="${thirdparty.dir}/jboss-jaxb-intros.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-container.jar" dest="${thirdparty.dir}/jboss-container.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-dependency.jar" dest="${thirdparty.dir}/jboss-dependency.jar" usetimestamp="true" verbose="true"/>
@@ -95,8 +100,8 @@
<get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-dependency-src.zip" dest="${thirdparty.dir}/jboss-dependency-src.zip" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-deployers-src.zip" dest="${thirdparty.dir}/jboss-deployers-src.zip" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/microcontainer/${jboss-microcontainer}/lib/jboss-microcontainer-src.zip" dest="${thirdparty.dir}/jboss-microcontainer-src.zip" usetimestamp="true" verbose="true"/>
- <get src="${jboss.repository}/jboss/remoting/${container-dependent.remoting.version}/lib/jboss-remoting.jar" dest="${thirdparty.dir}/jboss-remoting.jar" usetimestamp="true" verbose="true"/>
- <get src="${jboss.repository}/jboss/remoting/${container-dependent.remoting.version}/lib/jboss-remoting-src.jar" dest="${thirdparty.dir}/jboss-remoting-src.jar" usetimestamp="true" verbose="true"/>
+ <get src="${jboss.repository}/jboss/remoting/${jboss-remoting-jboss42}/lib/jboss-remoting.jar" dest="${thirdparty.dir}/jboss-remoting.jar" usetimestamp="true" verbose="true"/>
+ <get src="${jboss.repository}/jboss/remoting/${jboss-remoting-jboss42}/lib/jboss-remoting-src.jar" dest="${thirdparty.dir}/jboss-remoting-src.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx-client.jar" dest="${thirdparty.dir}/jbosssx-client.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx.jar" dest="${thirdparty.dir}/jbosssx.jar" usetimestamp="true" verbose="true"/>
<get src="${jboss.repository}/jboss/security/${jboss-security}/lib/jbosssx-src.zip" dest="${thirdparty.dir}/jbosssx-src.zip" usetimestamp="true" verbose="true"/>
16 years, 9 months
JBossWS SVN: r5869 - in stack/native/trunk: src/main/java/org/jboss/ws and 13 other directories.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 10:02:05 -0500 (Fri, 29 Feb 2008)
New Revision: 5869
Added:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/feature/
stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/
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/MyTestImpl.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTestService.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException_Exception.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/ObjectFactory.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTest.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTestResponse.java
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/package-info.java
stack/native/trunk/src/test/resources/jaxws/jbws1172/
stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl
stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/
stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml
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/SOAPContentElement.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java
stack/native/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
Log:
[JBWS-1172] Support schema validation for incoming/outgoing messages (WIP)
Modified: stack/native/trunk/ant-import-tests/build-jars-jaxws.xml
===================================================================
--- stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-29 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/ant-import-tests/build-jars-jaxws.xml 2008-02-29 15:02:05 UTC (rev 5869)
@@ -210,6 +210,14 @@
</fileset>
</jar>
+ <!-- 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/types/*.class"/>
+ </classes>
+ </war>
+
<!-- jaxws-jbws1178 -->
<war destfile="${tests.output.dir}/libs/jaxws-jbws1178.war" webxml="${tests.output.dir}/resources/jaxws/jbws1178/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/classes">
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 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/jaxws/spi/ServiceDelegateImpl.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -29,9 +29,11 @@
import java.net.URISyntaxException;
import java.net.URL;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Executor;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@@ -467,6 +469,7 @@
log.warn("WebServiceFeature not implemented");
Dispatch<T> dispatch = createDispatch(portName, type, mode);
+ initWebserviceFeatures(dispatch, features);
return dispatch;
}
@@ -485,6 +488,7 @@
Dispatch<T> dispatch = createDispatch(portName, type, mode);
initAddressingProperties(dispatch, epr);
+ initWebserviceFeatures(dispatch, features);
return dispatch;
}
@@ -495,6 +499,7 @@
log.warn("WebServiceFeature not implemented");
Dispatch<Object> dispatch = createDispatch(portName, context, mode);
+ initWebserviceFeatures(dispatch, features);
return dispatch;
}
@@ -513,6 +518,7 @@
Dispatch<Object> dispatch = createDispatch(portName, context, mode);
initAddressingProperties(dispatch, epr);
+ initWebserviceFeatures(dispatch, features);
return dispatch;
}
@@ -523,6 +529,7 @@
log.warn("WebServiceFeature not implemented");
T port = getPort(portName, sei);
+ initWebserviceFeatures(port, features);
return port;
}
@@ -534,6 +541,7 @@
T port = getPort(sei);
initAddressingProperties((BindingProvider)port, epr);
+ initWebserviceFeatures(port, features);
return port;
}
@@ -544,9 +552,23 @@
log.warn("WebServiceFeature not implemented");
T port = getPort(sei);
+ initWebserviceFeatures(port, features);
return port;
}
+ private <T> void initWebserviceFeatures(T stub, WebServiceFeature... features)
+ {
+ if (features != null)
+ {
+ Set<WebServiceFeature> featureSet = new HashSet<WebServiceFeature>();
+ for (WebServiceFeature feature : features)
+ featureSet.add(feature);
+
+ EndpointMetaData epMetaData = ((StubExt)stub).getEndpointMetaData();
+ epMetaData.setFeatures(featureSet);
+ }
+ }
+
// Workaround for [JBWS-2015] Modify addressing handlers to work with the JAXWS-2.1 API
private void initAddressingProperties(BindingProvider bindingProvider, EndpointReference epr)
{
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 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPBodyElementDoc.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -25,6 +25,11 @@
import javax.xml.soap.Name;
import javax.xml.soap.SOAPBodyElement;
+import org.jboss.logging.Logger;
+import org.jboss.ws.core.CommonMessageContext;
+import org.jboss.ws.core.soap.SOAPContent.State;
+import org.jboss.ws.feature.SchemaValidationFeature;
+
/**
* An abstract implemenation of the SOAPBodyElement
* <p/>
@@ -35,6 +40,12 @@
*/
public class SOAPBodyElementDoc extends SOAPContentElement implements SOAPBodyElement
{
+ // provide logging
+ private static Logger log = Logger.getLogger(SOAPBodyElementDoc.class);
+
+ private SchemaValidationFeature feature;
+ private boolean validated;
+
public SOAPBodyElementDoc(Name name)
{
super(name);
@@ -50,4 +61,36 @@
super(element);
}
+ @Override
+ protected State transitionTo(State nextState)
+ {
+ State prevState = soapContent.getState();
+ if (nextState != prevState)
+ {
+ if (doValidation() && nextState == State.OBJECT_VALID)
+ {
+ log.info("Validating: " + prevState);
+ validated = true;
+ }
+
+ log.info(prevState + "=>" + nextState);
+ prevState = super.transitionTo(nextState);
+
+ if (doValidation() && prevState == State.OBJECT_VALID)
+ {
+ log.info("Validating: " + nextState);
+ validated = true;
+ }
+ }
+ return prevState;
+ }
+
+ private boolean doValidation()
+ {
+ CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+ if (msgContext != null)
+ feature = msgContext.getEndpointMetaData().getFeature(SchemaValidationFeature.class);
+
+ return feature != null && validated == false;
+ }
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2008-02-29 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/core/soap/SOAPContentElement.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -81,7 +81,7 @@
private ParameterMetaData paramMetaData;
// content soapContent
- private SOAPContent soapContent;
+ protected SOAPContent soapContent;
// while transitioning DOM expansion needs to be locked
private boolean lockDOMExpansion = false;
@@ -129,12 +129,13 @@
return getParamMetaData().getJavaType();
}
- private void transitionTo(State nextState)
+ protected State transitionTo(State nextState)
{
- if (nextState != soapContent.getState())
+ State prevState = soapContent.getState();
+ if (nextState != prevState)
{
log.debug("-----------------------------------");
- log.debug("Transitioning from " + soapContent.getState() + " to " + nextState);
+ log.debug("Transitioning from " + prevState + " to " + nextState);
lockDOMExpansion = true;
soapContent = soapContent.transitionTo(nextState);
@@ -142,6 +143,7 @@
lockDOMExpansion = false;
log.debug("-----------------------------------");
}
+ return prevState;
}
/** Get the payload as source.
Added: 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 (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,92 @@
+/*
+ * 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.extensions.validation;
+
+//$Id$
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.jboss.logging.Logger;
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.common.DOMWriter;
+import org.jboss.wsf.common.IOUtils;
+import org.w3c.dom.Element;
+
+/**
+ * Extracts the schema from a given WSDL
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+public class SchemaExtractor
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(SchemaExtractor.class);
+
+ public URL getSchemaUrl(URL wsdlURL) throws IOException
+ {
+ // parse the wsdl
+ Element root = DOMUtils.parse(wsdlURL.openStream());
+
+ // get the types element
+ QName typesQName = new QName(root.getNamespaceURI(), "types");
+ Element typesEl = DOMUtils.getFirstChildElement(root, typesQName);
+ if (typesEl == null)
+ {
+ log.warn("Cannot find element: " + typesQName);
+ return null;
+ }
+
+ // get the schema element
+ QName schemaQName = new QName("http://www.w3.org/2001/XMLSchema", "schema");
+ List<Element> schemaElements = DOMUtils.getChildElementsAsList(typesEl, schemaQName);
+ if (schemaElements.size() == 0)
+ {
+ log.warn("Cannot find element: " + schemaQName);
+ return null;
+ }
+ if (schemaElements.size() > 1)
+ {
+ log.warn("Multiple schema elements not supported.");
+ }
+ Element schemaElement = schemaElements.get(0);
+
+ File tmpdir = IOUtils.createTempDirectory();
+ File tmpFile = File.createTempFile("jbossws_schema", ".xsd", tmpdir);
+ tmpFile.deleteOnExit();
+
+ OutputStreamWriter outwr = new OutputStreamWriter(new FileOutputStream(tmpFile));
+ DOMWriter domWriter = new DOMWriter(outwr);
+ domWriter.setPrettyprint(true);
+ domWriter.print(schemaElement);
+ outwr.close();
+
+ return tmpFile.toURL();
+ }
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/SchemaExtractor.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,58 @@
+/*
+ * 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.extensions.validation;
+
+//$Id$
+
+import org.jboss.logging.Logger;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/**
+ * Extracts the schema from a given WSDL
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+public class ValidationErrorHandler implements ErrorHandler
+{
+ // provide logging
+ private static Logger log = Logger.getLogger(ValidationErrorHandler.class);
+
+ public void error(SAXParseException ex) throws SAXException
+ {
+ log.error(ex.toString());
+ throw new SAXException(ex.getMessage());
+ }
+
+ public void fatalError(SAXParseException ex) throws SAXException
+ {
+ log.fatal(ex.toString());
+ throw new SAXException(ex.getMessage());
+ }
+
+ public void warning(SAXParseException ex) throws SAXException
+ {
+ log.warn(ex.toString());
+ }
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/extensions/validation/ValidationErrorHandler.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java (rev 0)
+++ stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,118 @@
+/*
+ * 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.feature;
+
+// $Id$
+
+import javax.xml.ws.WebServiceFeature;
+
+import org.jboss.ws.Constants;
+import org.jboss.ws.extensions.validation.ValidationErrorHandler;
+import org.xml.sax.ErrorHandler;
+
+/**
+ * This feature represents the use of schema validation with a
+ * web service.
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 29-Feb-2008
+ */
+public final class SchemaValidationFeature extends WebServiceFeature
+{
+ /**
+ * Constant value identifying the SchemaValidationFeature
+ */
+ public static final String ID = Constants.NS_JBOSSWS_URI + "/features/schema-validation";
+
+ /**
+ * 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".
+ */
+ protected String schemaLocation;
+
+ /**
+ * Optional property for the error handler.
+ * If this is not specified the @{ValidationErrorHandler} will be used.
+ */
+ protected ErrorHandler errorHandler = new ValidationErrorHandler();
+
+ /**
+ * Create an <code>SchemaValidationFeature</code>.
+ * The instance created will be enabled.
+ */
+ public SchemaValidationFeature()
+ {
+ this.enabled = true;
+ }
+
+ /**
+ * Creates an <code>SchemaValidationFeature</code>.
+ *
+ * @param enabled specifies if this feature should be enabled or not
+ */
+ public SchemaValidationFeature(boolean enabled)
+ {
+ this.enabled = enabled;
+ }
+
+ /**
+ * Creates an <code>SchemaValidationFeature</code>.
+ *
+ * @param schemaLocation specifies the schema location for this feature
+ */
+ public SchemaValidationFeature(String schemaLocation)
+ {
+ this.schemaLocation = schemaLocation;
+ }
+
+ /**
+ * Creates an <code>SchemaValidationFeature</code>.
+ *
+ * @param enabled specifies if this feature should be enabled or not
+ * @param schemaLocation specifies the schema location for this feature
+ */
+ public SchemaValidationFeature(boolean enabled, String schemaLocation)
+ {
+ this.enabled = enabled;
+ this.schemaLocation = schemaLocation;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public String getID()
+ {
+ return ID;
+ }
+
+ public ErrorHandler getErrorHandler()
+ {
+ return errorHandler;
+ }
+
+ public void setErrorHandler(ErrorHandler errorHandler)
+ {
+ this.errorHandler = errorHandler;
+ }
+}
Property changes on: stack/native/trunk/src/main/java/org/jboss/ws/feature/SchemaValidationFeature.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Modified: stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2008-02-29 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/ClientEndpointMetaData.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -40,6 +40,7 @@
{
// The endpoint address
private String endpointAddress;
+ private String documentation;
public ClientEndpointMetaData(ServiceMetaData service, QName qname, QName portTypeName, Type type)
{
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 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/metadata/umdm/EndpointMetaData.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -41,6 +41,7 @@
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
+import javax.xml.ws.WebServiceFeature;
import javax.xml.ws.Service.Mode;
import org.jboss.logging.Logger;
@@ -148,6 +149,10 @@
private Map<Method, OperationMetaData> opMetaDataCache = new HashMap<Method, OperationMetaData>();
// All of the registered types
private List<Class> registeredTypes = new ArrayList<Class>();
+ // The features defined for this endpoint
+ private Set<WebServiceFeature> features = new HashSet<WebServiceFeature>();
+ // The documentation edfined through the @Documentation annotation
+ private String documentation;
private ConfigObservable configObservable = new ConfigObservable();
@@ -157,8 +162,6 @@
private List<BindingCustomization> bindingCustomization = new ArrayList<BindingCustomization>();
- private String documentation;
-
public EndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName, Type type)
{
this.serviceMetaData = service;
@@ -360,6 +363,36 @@
this.properties = properties;
}
+ public <T extends WebServiceFeature> T getFeature(Class<T> key)
+ {
+ for (WebServiceFeature feature : features)
+ {
+ if (key.isAssignableFrom(feature.getClass()))
+ return (T)feature;
+ }
+ return null;
+ }
+
+ public Set<WebServiceFeature> getFeatures()
+ {
+ return features;
+ }
+
+ public void setFeatures(Set<WebServiceFeature> features)
+ {
+ this.features = features;
+ }
+
+ public String getDocumentation()
+ {
+ return documentation;
+ }
+
+ public void setDocumentation(String documentation)
+ {
+ this.documentation = documentation;
+ }
+
public List<OperationMetaData> getOperations()
{
return new ArrayList<OperationMetaData>(operations);
@@ -922,14 +955,4 @@
}
return match;
}
-
- public String getDocumentation()
- {
- return documentation;
- }
-
- public void setDocumentation(String documentation)
- {
- this.documentation = documentation;
- }
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2008-02-29 14:53:27 UTC (rev 5868)
+++ stack/native/trunk/src/main/java/org/jboss/ws/tools/metadata/ToolsEndpointMetaData.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -38,6 +38,7 @@
{
public String typeNamespace;
private String endpointAddress;
+ private String documentation;
public ToolsEndpointMetaData(ServiceMetaData service, QName portName, QName portTypeName)
{
Added: 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 (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,135 @@
+/*
+ * 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 java.io.ByteArrayInputStream;
+import java.io.File;
+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.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.SAXException;
+
+/**
+ * [JBWS-1172] Support schema validation for incoming messages
+ *
+ * http://jira.jboss.org/jira/browse/JBWS-1172
+ *
+ * @author Thomas.Diesler(a)jboss.com
+ * @since 28-Feb-2008
+ */
+public class JBWS1172TestCase extends JBossWSTest
+{
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS1172TestCase.class, "jaxws-jbws1172.war");
+ }
+
+ public void testSchemaValidationPositive() throws Exception
+ {
+ URL xsdURL = new File("resources/jaxws/jbws1172/TestService.xsd").toURL();
+ String inxml = "<performTest xmlns='http://www.my-company.it/ws/my-test'><Code>1000</Code></performTest>";
+ parseDocument(inxml, xsdURL);
+ }
+
+ public void testSchemaValidationNegative() throws Exception
+ {
+ URL xsdURL = new File("resources/jaxws/jbws1172/TestService.xsd").toURL();
+ String inxml = "<performTest xmlns='http://www.my-company.it/ws/my-test'><Code>2000</Code></performTest>";
+ try
+ {
+ parseDocument(inxml, xsdURL);
+ }
+ catch (SAXException ex)
+ {
+ String msg = ex.getMessage();
+ assertTrue("Unexpectd message: " + msg, msg.indexOf("Value '2000' is not facet-valid with respect to maxInclusive '1000'") > 0);
+ }
+ }
+
+ public void testSchemaExtractor() throws Exception
+ {
+ URL wsdlURL = new File("resources/jaxws/jbws1172/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);
+ }
+
+ public void testEndpointWsdlValidation() throws Exception
+ {
+ URL wsdlURL = new URL("http://" + getServerHost() + ":8080/jaxws-jbws1172?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);
+ }
+
+ public void testNonValidatingClient() 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);
+ MyTest port = service.getPort(MyTest.class);
+ port.performTest(new Long(1000));
+ }
+
+ public void testValidatingClientWithExplicitSchema() 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()));
+ port.performTest(new Long(1000));
+ }
+
+ private void parseDocument(String inxml, URL xsdURL) throws Exception
+ {
+ DocumentBuilder builder = getDocumentBuilder(xsdURL);
+ ByteArrayInputStream bais = new ByteArrayInputStream(inxml.getBytes());
+ builder.parse(bais);
+ }
+
+ 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/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+ factory.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", xsdURL.toExternalForm());
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ builder.setErrorHandler(new ValidationErrorHandler());
+ return builder;
+ }
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/JBWS1172TestCase.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: 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 (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,19 @@
+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);
+ }
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/MyTestImpl.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTest.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTest.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTest.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,35 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.xml.ws.RequestWrapper;
+import javax.xml.ws.ResponseWrapper;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1-b03-
+ * Generated source version: 2.0
+ *
+ */
+@WebService(name = "MyTest", targetNamespace = "http://www.my-company.it/ws/my-test")
+public interface MyTest {
+
+
+ /**
+ *
+ * @param code
+ * @throws MyWSException_Exception
+ */
+ @WebMethod(action = "urn:performTest")
+ @RequestWrapper(localName = "performTest", targetNamespace = "http://www.my-company.it/ws/my-test", className = "org.jboss.test.ws.jaxws.jbws1172.types.PerformTest")
+ @ResponseWrapper(localName = "performTestResponse", targetNamespace = "http://www.my-company.it/ws/my-test", className = "org.jboss.test.ws.jaxws.jbws1172.types.PerformTestResponse")
+ public void performTest(
+ @WebParam(name = "Code", targetNamespace = "http://www.my-company.it/ws/my-test")
+ Long code)
+ throws MyWSException_Exception
+ ;
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTestService.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTestService.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTestService.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,53 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1-b03-
+ * Generated source version: 2.0
+ *
+ */
+@WebServiceClient(name = "MyTestService", targetNamespace = "http://www.my-company.it/ws/my-test", wsdlLocation = "file:/home/tdiesler/svn/jbossws/stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl")
+public class MyTestService
+ extends Service
+{
+
+ private final static URL MYTESTSERVICE_WSDL_LOCATION;
+
+ static {
+ URL url = null;
+ try {
+ url = new URL("file:/home/tdiesler/svn/jbossws/stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl");
+ } catch (MalformedURLException e) {
+ e.printStackTrace();
+ }
+ MYTESTSERVICE_WSDL_LOCATION = url;
+ }
+
+ public MyTestService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ public MyTestService() {
+ super(MYTESTSERVICE_WSDL_LOCATION, new QName("http://www.my-company.it/ws/my-test", "MyTestService"));
+ }
+
+ /**
+ *
+ * @return
+ * returns MyTest
+ */
+ @WebEndpoint(name = "MyTestPort")
+ public MyTest getMyTestPort() {
+ return (MyTest)super.getPort(new QName("http://www.my-company.it/ws/my-test", "MyTestPort"), MyTest.class);
+ }
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyTestService.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,62 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for MyWSException complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="MyWSException">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="message" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MyWSException", propOrder = {
+ "message"
+})
+public class MyWSException {
+
+ @XmlElement(required = true, nillable = true)
+ protected String message;
+
+ /**
+ * Gets the value of the message property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Sets the value of the message property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMessage(String value) {
+ this.message = value;
+ }
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException_Exception.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException_Exception.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException_Exception.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,54 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.xml.ws.WebFault;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.1.1-b03-
+ * Generated source version: 2.0
+ *
+ */
+@WebFault(name = "MyWSException", targetNamespace = "http://www.my-company.it/ws/my-test")
+public class MyWSException_Exception
+ extends Exception
+{
+
+ /**
+ * Java type that goes as soapenv:Fault detail element.
+ *
+ */
+ private MyWSException faultInfo;
+
+ /**
+ *
+ * @param faultInfo
+ * @param message
+ */
+ public MyWSException_Exception(String message, MyWSException faultInfo) {
+ super(message);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ *
+ * @param faultInfo
+ * @param message
+ * @param cause
+ */
+ public MyWSException_Exception(String message, MyWSException faultInfo, Throwable cause) {
+ super(message, cause);
+ this.faultInfo = faultInfo;
+ }
+
+ /**
+ *
+ * @return
+ * returns fault bean: org.jboss.test.ws.jaxws.jbws1172.types.MyWSException
+ */
+ public MyWSException getFaultInfo() {
+ return faultInfo;
+ }
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/MyWSException_Exception.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/ObjectFactory.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/ObjectFactory.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/ObjectFactory.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,89 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.annotation.XmlElementDecl;
+import javax.xml.bind.annotation.XmlRegistry;
+import javax.xml.namespace.QName;
+
+
+/**
+ * This object contains factory methods for each
+ * Java content interface and Java element interface
+ * generated in the org.jboss.test.ws.jaxws.jbws1172.types package.
+ * <p>An ObjectFactory allows you to programatically
+ * construct new instances of the Java representation
+ * for XML content. The Java representation of XML
+ * content can consist of schema derived interfaces
+ * and classes representing the binding of schema
+ * type definitions, element declarations and model
+ * groups. Factory methods for each of these are
+ * provided in this class.
+ *
+ */
+@XmlRegistry
+public class ObjectFactory {
+
+ private final static QName _PerformTest_QNAME = new QName("http://www.my-company.it/ws/my-test", "performTest");
+ private final static QName _MyWSException_QNAME = new QName("http://www.my-company.it/ws/my-test", "MyWSException");
+ private final static QName _PerformTestResponse_QNAME = new QName("http://www.my-company.it/ws/my-test", "performTestResponse");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.jboss.test.ws.jaxws.jbws1172.types
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link MyWSException }
+ *
+ */
+ public MyWSException createMyWSException() {
+ return new MyWSException();
+ }
+
+ /**
+ * Create an instance of {@link PerformTest }
+ *
+ */
+ public PerformTest createPerformTest() {
+ return new PerformTest();
+ }
+
+ /**
+ * Create an instance of {@link PerformTestResponse }
+ *
+ */
+ public PerformTestResponse createPerformTestResponse() {
+ return new PerformTestResponse();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link PerformTest }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.my-company.it/ws/my-test", name = "performTest")
+ public JAXBElement<PerformTest> createPerformTest(PerformTest value) {
+ return new JAXBElement<PerformTest>(_PerformTest_QNAME, PerformTest.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link MyWSException }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.my-company.it/ws/my-test", name = "MyWSException")
+ public JAXBElement<MyWSException> createMyWSException(MyWSException value) {
+ return new JAXBElement<MyWSException>(_MyWSException_QNAME, MyWSException.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link PerformTestResponse }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://www.my-company.it/ws/my-test", name = "performTestResponse")
+ public JAXBElement<PerformTestResponse> createPerformTestResponse(PerformTestResponse value) {
+ return new JAXBElement<PerformTestResponse>(_PerformTestResponse_QNAME, PerformTestResponse.class, null, value);
+ }
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/ObjectFactory.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTest.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTest.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTest.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,62 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for performTest complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="performTest">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="Code" type="{http://www.w3.org/2001/XMLSchema}long"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "performTest", propOrder = {
+ "code"
+})
+public class PerformTest {
+
+ @XmlElement(name = "Code", required = true, type = Long.class, nillable = true)
+ protected Long code;
+
+ /**
+ * Gets the value of the code property.
+ *
+ * @return
+ * possible object is
+ * {@link Long }
+ *
+ */
+ public Long getCode() {
+ return code;
+ }
+
+ /**
+ * Sets the value of the code property.
+ *
+ * @param value
+ * allowed object is
+ * {@link Long }
+ *
+ */
+ public void setCode(Long value) {
+ this.code = value;
+ }
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTest.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTestResponse.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTestResponse.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTestResponse.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,32 @@
+
+package org.jboss.test.ws.jaxws.jbws1172.types;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for performTestResponse complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * <complexType name="performTestResponse">
+ * <complexContent>
+ * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "performTestResponse")
+public class PerformTestResponse {
+
+
+}
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/PerformTestResponse.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/package-info.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/package-info.java (rev 0)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/package-info.java 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,2 @@
+(a)javax.xml.bind.annotation.XmlSchema(namespace = "http://www.my-company.it/ws/my-test", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.jboss.test.ws.jaxws.jbws1172.types;
Property changes on: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/jbws1172/types/package-info.java
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl (rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl 2008-02-29 15:02:05 UTC (rev 5869)
@@ -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://my-company.it/my-context/my-endpoint"/>
+ </port>
+ </service>
+</definitions>
\ No newline at end of file
Property changes on: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.wsdl
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd (rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,25 @@
+<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>
Property changes on: stack/native/trunk/src/test/resources/jaxws/jbws1172/TestService.xsd
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
Added: stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml
===================================================================
--- stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml (rev 0)
+++ stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml 2008-02-29 15:02:05 UTC (rev 5869)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ 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>
+
+ <servlet-mapping>
+ <servlet-name>TestEndpoint</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
\ No newline at end of file
Property changes on: stack/native/trunk/src/test/resources/jaxws/jbws1172/WEB-INF/web.xml
___________________________________________________________________
Name: svn:keywords
+ Id Revision
Name: svn:eol-style
+ LF
16 years, 10 months
JBossWS SVN: r5868 - stack/native/trunk/src/test/resources.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 09:53:27 -0500 (Fri, 29 Feb 2008)
New Revision: 5868
Modified:
stack/native/trunk/src/test/resources/test-excludes-jboss501.txt
Log:
TODO: Fix classpath to ClientLauncher
Modified: stack/native/trunk/src/test/resources/test-excludes-jboss501.txt
===================================================================
--- stack/native/trunk/src/test/resources/test-excludes-jboss501.txt 2008-02-29 14:34:03 UTC (rev 5867)
+++ stack/native/trunk/src/test/resources/test-excludes-jboss501.txt 2008-02-29 14:53:27 UTC (rev 5868)
@@ -25,3 +25,6 @@
# [JBAS-5257] jboss:service=defaultClassLoader is not registered with dynamic webapp deployment
org/jboss/test/ws/jaxws/endpoint/**
+# TODO: Fix classpath to ClientLauncher
+org/jboss/test/ws/jaxws/samples/webserviceref/**
+org/jboss/test/ws/jaxws/webserviceref/**
16 years, 10 months
JBossWS SVN: r5867 - stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/binding.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-02-29 09:34:03 -0500 (Fri, 29 Feb 2008)
New Revision: 5867
Modified:
stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
Log:
remove useless imports and remove commented out code
Modified: stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java
===================================================================
--- stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2008-02-29 14:33:21 UTC (rev 5866)
+++ stack/native/trunk/src/test/java/org/jboss/test/ws/jaxws/binding/SOAPBindingTestCase.java 2008-02-29 14:34:03 UTC (rev 5867)
@@ -21,8 +21,6 @@
*/
package org.jboss.test.ws.jaxws.binding;
-// $Id: $
-
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -42,11 +40,8 @@
import org.jboss.ws.Constants;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
-import org.jboss.wsf.common.DOMUtils;
-import org.jboss.wsf.common.DOMWriter;
import org.jboss.wsf.test.JBossWSTest;
import org.jboss.wsf.test.JBossWSTestSetup;
-import org.w3c.dom.Element;
/**
* Test SOAP12 binding type
@@ -67,8 +62,6 @@
public void testWSDLAccess() throws Exception
{
URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
- //Element root = DOMUtils.parse(wsdlURL.openStream());
- //System.out.println(DOMWriter.printNode(root, true));
WSDLDefinitions defs = WSDLDefinitionsFactory.newInstance().parse(wsdlURL);
Definition wsdl = defs.getWsdlOneOneDefinition();
16 years, 10 months
JBossWS SVN: r5866 - in stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm: common and 4 other directories.
by jbossws-commits@lists.jboss.org
Author: richard.opalka(a)jboss.com
Date: 2008-02-29 09:33:21 -0500 (Fri, 29 Feb 2008)
New Revision: 5866
Modified:
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMConstantsImpl.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceFaultSerializer.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMConstants.java
stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFaultCode.java
Log:
implemented RMFault serialization
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/RMFault.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -82,7 +82,7 @@
@Override
public String getMessage()
{
- return faultCode.getSubcode() + ": " + faultCode.getReason();
+ return faultCode.getReason();
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMConstantsImpl.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMConstantsImpl.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/RMConstantsImpl.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -55,6 +55,7 @@
private final QName lastMsgNumberQName;
private final QName lowerQName;
private final QName messageNumberQName;
+ private final QName maxMessageNumberQName;
private final QName nackQName;
private final QName noneQName;
private final QName offerQName;
@@ -89,6 +90,7 @@
this.lastMsgNumberQName = new QName(namespaceURI, "LastMsgNumber", prefix);
this.lowerQName = new QName(null, "Lower", "");
this.messageNumberQName = new QName(namespaceURI, "MessageNumber", prefix);
+ this.maxMessageNumberQName = new QName(namespaceURI, "MaxMessageNumber", prefix);
this.nackQName = new QName(namespaceURI, "Nack", prefix);
this.noneQName = new QName(namespaceURI, "None", prefix);
this.offerQName = new QName(namespaceURI, "Offer", prefix);
@@ -277,6 +279,14 @@
}
/**
+ * @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getMaxMessageNumberQName()
+ */
+ public final QName getMaxMessageNumberQName()
+ {
+ return this.maxMessageNumberQName;
+ }
+
+ /**
* @see org.jboss.ws.extensions.wsrm.spi.RMConstants#getNackQName()
*/
public final QName getNackQName()
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceFaultSerializer.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceFaultSerializer.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/common/serialization/RMSequenceFaultSerializer.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -21,11 +21,24 @@
*/
package org.jboss.ws.extensions.wsrm.common.serialization;
+import java.util.Map;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPConstants;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPException;
import javax.xml.soap.SOAPMessage;
import org.jboss.util.NotImplementedException;
+import org.jboss.ws.extensions.wsrm.RMFault;
+import org.jboss.ws.extensions.wsrm.RMFaultConstant;
import org.jboss.ws.extensions.wsrm.api.RMException;
+import org.jboss.ws.extensions.wsrm.spi.RMConstants;
import org.jboss.ws.extensions.wsrm.spi.RMProvider;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceAcknowledgement;
+import org.jboss.ws.extensions.wsrm.spi.protocol.RMSequenceFault;
import org.jboss.ws.extensions.wsrm.spi.protocol.RMSerializable;
/**
@@ -48,10 +61,10 @@
}
/**
- * Deserialize <b>SequenceFault</b> using <b>provider</b> from the <b>soapMessage</b>
- * @param object to be deserialized
- * @param provider wsrm provider to be used for deserialization process
- * @param soapMessage soap message from which object will be deserialized
+ * Serialize <b>SequenceFault</b> using <b>provider</b> to the <b>soapMessage</b>
+ * @param object to be serialized
+ * @param provider wsrm provider to be used for serialization process
+ * @param soapMessage soap message to which object will be serialized
*/
public final void deserialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage)
throws RMException
@@ -60,15 +73,85 @@
}
/**
- * Serialize <b>SequenceFault</b> using <b>provider</b> to the <b>soapMessage</b>
- * @param object to be serialized
- * @param provider wsrm provider to be used for serialization process
- * @param soapMessage soap message to which object will be serialized
+ * Deserialize <b>SequenceFault</b> using <b>provider</b> from the <b>soapMessage</b>
+ * @param object to be deserialized
+ * @param provider wsrm provider to be used for deserialization process
+ * @param soapMessage soap message from which object will be deserialized
*/
public final void serialize(RMSerializable object, RMProvider provider, SOAPMessage soapMessage)
throws RMException
{
- throw new NotImplementedException();
+ RMSequenceFault o = (RMSequenceFault)object;
+ try
+ {
+ SOAPEnvelope soapEnvelope = soapMessage.getSOAPPart().getEnvelope();
+ boolean isSoap11 = SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE.equals(soapEnvelope.getElementQName().getNamespaceURI());
+ if (false == isSoap11)
+ {
+ throw new NotImplementedException("TODO: implement SOAP 12 serialization");
+ }
+
+ RMConstants wsrmConstants = provider.getConstants();
+
+ // Add xmlns:wsrm declaration
+ soapEnvelope.addNamespaceDeclaration(wsrmConstants.getPrefix(), wsrmConstants.getNamespaceURI());
+
+ // write required wsrm:SequenceFault element
+ QName sequenceFaultQName = wsrmConstants.getSequenceFaultQName();
+ SOAPElement sequenceFaultElement = soapEnvelope.getHeader().addChildElement(sequenceFaultQName);
+
+ // write required wsrm:FaultCode element
+ RMFault rmFault = (RMFault)o.getDetail();
+ QName faultCodeQName = wsrmConstants.getFaultCodeQName();
+ String subcode = wsrmConstants.getPrefix() + ":" + rmFault.getFaultCode().getSubcode().getValue();
+ sequenceFaultElement.addChildElement(faultCodeQName).setValue(subcode);
+
+ Map<String, Object> details = rmFault.getDetails();
+ if (details.size() > 0)
+ {
+ for (Iterator<String> i = details.keySet().iterator(); i.hasNext(); )
+ {
+ // write optional wsrm:Detail elements
+ QName detailQName = wsrmConstants.getDetailQName();
+ SOAPElement detailElement = sequenceFaultElement.addChildElement(detailQName);
+
+ String key = i.next();
+ if (RMFaultConstant.IDENTIFIER.equals(key))
+ {
+ // write optional wsrm:Identifier element
+ String sequenceId = (String)details.get(key);
+ QName identifierQName = wsrmConstants.getIdentifierQName();
+ detailElement.addChildElement(identifierQName).setValue(sequenceId);
+ }
+ else if (RMFaultConstant.ACKNOWLEDGEMENT.equals(key))
+ {
+ // write optional wsrm:AcknowledgementRange element
+ RMSequenceAcknowledgement.RMAcknowledgementRange ackRange = (RMSequenceAcknowledgement.RMAcknowledgementRange)details.get(key);
+ QName acknowledgementRangeQName = wsrmConstants.getAcknowledgementRangeQName();
+ QName upperQName = wsrmConstants.getUpperQName();
+ QName lowerQName = wsrmConstants.getLowerQName();
+
+ SOAPElement acknowledgementRangeElement = detailElement.addChildElement(acknowledgementRangeQName);
+ // write required wsrm:Lower attribute
+ acknowledgementRangeElement.addAttribute(lowerQName, String.valueOf(ackRange.getLower()));
+ // write required wsrm:Upper attribute
+ acknowledgementRangeElement.addAttribute(upperQName, String.valueOf(ackRange.getUpper()));
+ }
+ else if (RMFaultConstant.MAX_MESSAGE_NUMBER.equals(key))
+ {
+ // write optional wsrm:MaxMessageNumber element
+ Long maxMessageNumber = (Long)details.get(key);
+ QName maxMessageNumberQName = wsrmConstants.getMaxMessageNumberQName();
+ detailElement.addChildElement(maxMessageNumberQName).setValue(maxMessageNumber.toString());
+ }
+ else throw new IllegalArgumentException("Can't serialize detail with key " + key);
+ }
+ }
+ }
+ catch (SOAPException se)
+ {
+ throw new RMException("Unable to serialize RM message", se);
+ }
}
}
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/server/RMInvocationHandler.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -305,6 +305,7 @@
protocolMessages.add(rmConstants.getSequenceFaultQName());
rmResponseContext.put(RMConstant.PROTOCOL_MESSAGES, protocolMessages);
rmResponseContext.put(RMConstant.FAULT_REFERENCE, fault);
+ rmResponseContext.put(RMConstant.ONE_WAY_OPERATION, false);
CommonMessageContext msgCtx = MessageContextAssociation.peekMessageContext();
msgCtx.put(RMConstant.RESPONSE_CONTEXT, rmResponseContext);
throw fault; // rethrow
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMConstants.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMConstants.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/RMConstants.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -153,6 +153,12 @@
/**
* getter
+ * @return <b>MaxMessageNumber</b> QName
+ */
+ QName getMaxMessageNumberQName();
+
+ /**
+ * getter
* @return <b>AckRequested</b> QName
*/
QName getAckRequestedQName();
Modified: stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFaultCode.java
===================================================================
--- stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFaultCode.java 2008-02-29 09:55:15 UTC (rev 5865)
+++ stack/native/trunk/src/main/java/org/jboss/ws/extensions/wsrm/spi/protocol/RMSequenceFaultCode.java 2008-02-29 14:33:21 UTC (rev 5866)
@@ -29,43 +29,57 @@
*/
public enum RMSequenceFaultCode
{
+
/**
* Sequence terminated
*/
- SEQUENCE_TERMINATED,
+ SEQUENCE_TERMINATED("SequenceTerminated"),
/**
* Unknown sequence
*/
- UNKNOWN_SEQUENCE,
+ UNKNOWN_SEQUENCE("UnknownSequence"),
/**
* Invalid acknowledgement
*/
- INVALID_ACKNOWLEDGEMENT,
+ INVALID_ACKNOWLEDGEMENT("InvalidAcknowledgement"),
/**
* Message number rollover
*/
- MESSAGE_NUMBER_ROLLOVER,
+ MESSAGE_NUMBER_ROLLOVER("MessageNumberRollover"),
/**
* Create sequence refused
*/
- CREATE_SEQUENCE_REFUSED,
+ CREATE_SEQUENCE_REFUSED("CreateSequenceRefused"),
/**
* Sequence closed
*/
- SEQUENCE_CLOSED,
+ SEQUENCE_CLOSED("SequenceClosed"),
/**
* WSRM required
*/
- WSRM_REQUIRED,
+ WSRM_REQUIRED("WSRMRequired"),
/**
* Last message number exceeded
*/
- LAST_MESSAGE_NUMBER_EXCEEDED
+ LAST_MESSAGE_NUMBER_EXCEEDED("LastMessageNumberExceeded");
+
+ private final String value;
+
+ RMSequenceFaultCode(String value)
+ {
+ this.value = value;
+ }
+
+ public final String getValue()
+ {
+ return this.value;
+ }
+
}
16 years, 10 months
JBossWS SVN: r5865 - stack/native/trunk/src/main/java/javax/xml/ws/wsaddressing.
by jbossws-commits@lists.jboss.org
Author: thomas.diesler(a)jboss.com
Date: 2008-02-29 04:55:15 -0500 (Fri, 29 Feb 2008)
New Revision: 5865
Modified:
stack/native/trunk/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
Log:
Use standard JAXBContext factory method
Modified: stack/native/trunk/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java
===================================================================
--- stack/native/trunk/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java 2008-02-29 09:26:15 UTC (rev 5864)
+++ stack/native/trunk/src/main/java/javax/xml/ws/wsaddressing/W3CEndpointReference.java 2008-02-29 09:55:15 UTC (rev 5865)
@@ -44,7 +44,6 @@
import javax.xml.ws.EndpointReference;
import javax.xml.ws.WebServiceException;
-import org.jboss.ws.core.jaxws.JAXBContextFactory;
import org.w3c.dom.Element;
/**
@@ -219,7 +218,14 @@
private static JAXBContext getW3CJaxbContext()
{
- return JAXBContextFactory.newInstance().createContext(new Class[] { W3CEndpointReference.class });
+ try
+ {
+ return JAXBContext.newInstance(new Class[] { W3CEndpointReference.class });
+ }
+ catch (JAXBException ex)
+ {
+ throw new WebServiceException("Cannot obtain JAXB context", ex);
+ }
}
private static class Address
16 years, 10 months