Author: klape
Date: 2013-09-11 14:56:24 -0400 (Wed, 11 Sep 2013)
New Revision: 17915
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/cxf.xml
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
Log:
[JBPAPP-10859] Schema validatation doesn't work in mtom enabled provider service.
Used the fix that doesn't require msv-core.jar
Modified:
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java 2013-09-11
16:08:03 UTC (rev 17914)
+++
thirdparty/cxf/branches/cxf-2.2.12/rt/core/src/main/java/org/apache/cxf/databinding/source/XMLStreamDataReader.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -38,6 +38,7 @@
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
import org.xml.sax.SAXException;
@@ -45,6 +46,7 @@
import org.apache.cxf.common.logging.LogUtils;
import org.apache.cxf.common.util.StringUtils;
import org.apache.cxf.databinding.DataReader;
+import org.apache.cxf.helpers.DOMUtils;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.io.CachedOutputStream;
import org.apache.cxf.message.Attachment;
@@ -176,13 +178,32 @@
private Element validate(XMLStreamReader input)
throws XMLStreamException, SAXException, IOException {
- DOMSource ds = read(input);
- schema.newValidator().validate(ds);
- Node nd = ds.getNode();
- if (nd instanceof Document) {
- return ((Document)nd).getDocumentElement();
+ DOMSource ds = read(input);
+ Element rootElement = null;
+ if (ds.getNode() instanceof Document) {
+ rootElement = ((Document)ds.getNode()).getDocumentElement();
+ } else {
+ rootElement = (Element)ds.getNode();
}
- return (Element)ds.getNode();
+ NodeList includeList =
+
rootElement.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/in...;,
"Include");
+ if (includeList.getLength() > 0) {
+ Element newElement = (Element)rootElement.cloneNode(true);
+ NodeList nodeList =
+
newElement.getElementsByTagNameNS("http://www.w3.org/2004/08/xop/inc...;,
"Include");
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Element include = (Element)nodeList.item(i);
+ Node parentNode = include.getParentNode();
+ parentNode.removeChild(include);
+ String cid = DOMUtils.getAttribute(include, "href");
+ //set the fake base64Binary to validate instead of reading the attachment
from message
+
parentNode.setTextContent(javax.xml.bind.DatatypeConverter.printBase64Binary(cid.getBytes()));
+ }
+ schema.newValidator().validate(new DOMSource(newElement));
+ } else {
+ schema.newValidator().validate(ds);
+ }
+ return rootElement;
}
private InputStream getInputStream(XMLStreamReader input)
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionType.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlType;
+
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "ExceptionType")
+public class ExceptionType {
+
+ 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;
+ }
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/ExceptionTypeException.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.ws.WebFault;
+@WebFault(name = "ExceptionType", targetNamespace =
"http://cxf.apache.org/")
+public class ExceptionTypeException extends Exception {
+ public static final long serialVersionUID = 20130719154625L;
+
+ private ExceptionType exceptionType;
+
+ public ExceptionTypeException() {
+ super();
+ }
+
+ public ExceptionTypeException(String message) {
+ super(message);
+ }
+
+ public ExceptionTypeException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public ExceptionTypeException(String message, ExceptionType exceptionType) {
+ super(message);
+ this.exceptionType = exceptionType;
+ }
+
+ public ExceptionTypeException(String message, ExceptionType exceptionType, Throwable
cause) {
+ super(message, cause);
+ this.exceptionType = exceptionType;
+ }
+
+ public ExceptionType getFaultInfo() {
+ return this.exceptionType;
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Hello.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,109 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.activation.DataHandler;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlMimeType;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for hello complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="hello">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="arg0"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * <element name="file"
type="{http://www.w3.org/2001/XMLSchema}base64Binary"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "hello", propOrder = {
+ "arg0",
+ "file"
+ })
+public class Hello {
+
+ protected String arg0;
+ @XmlElement(required = true)
+ @XmlMimeType("application/octet-stream")
+ protected DataHandler file;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getArg0() {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setArg0(String value) {
+ this.arg0 = value;
+ }
+
+ /**
+ * Gets the value of the file property.
+ *
+ * @return
+ * possible object is
+ * {@link DataHandler }
+ *
+ */
+ public DataHandler getFile() {
+ return file;
+ }
+
+ /**
+ * Sets the value of the file property.
+ *
+ * @param value
+ * allowed object is
+ * {@link DataHandler }
+ *
+ */
+ public void setFile(DataHandler value) {
+ this.file = value;
+ }
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloResponse.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,77 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+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 helloResponse complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="helloResponse">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return"
type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "helloResponse")
+public class HelloResponse {
+
+ @XmlElement(name = "return")
+ protected String res;
+
+ /**
+ * Gets the value of the return property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getReturn() {
+ return res;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setReturn(String value) {
+ this.res = value;
+ }
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWS.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+
+@WebService(targetNamespace = "http://cxf.apache.org/", name =
"HelloWS")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface HelloWS {
+
+ @WebResult(name = "helloResponse", targetNamespace =
"http://cxf.apache.org/", partName = "parameters")
+ @WebMethod
+ HelloResponse hello(@WebParam(partName = "parameters",
+ name = "helloRequest",
+ targetNamespace =
"http://cxf.apache.org/") Hello parameters)
+ throws ExceptionTypeException;
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/HelloWSClient.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebEndpoint;
+import javax.xml.ws.WebServiceClient;
+import javax.xml.ws.WebServiceFeature;
+
+@WebServiceClient(name = "HelloWS", targetNamespace =
"http://cxf.apache.org/")
+public class HelloWSClient extends Service {
+ private QName portName = new
QName("http://cxf.apache.org/",
"hello");
+
+ public HelloWSClient(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ /**
+ * @return returns HelloWS
+ */
+ @WebEndpoint(name = "hello")
+ public HelloWS getHello() {
+ return super.getPort(portName, HelloWS.class);
+ }
+
+ /**
+ * @param features A list of {@link javax.xml.ws.WebServiceFeature} to configure on
the proxy. Supported
+ * features not in the <code>features</code> parameter will
have their default values.
+ * @return returns HelloWS
+ */
+ @WebEndpoint(name = "hello")
+ public HelloWS getHello(WebServiceFeature... features) {
+ return super.getPort(portName, HelloWS.class, features);
+ }
+
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/MTOMProviderSchemaValidationTest.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.io.File;
+import java.net.URL;
+
+import javax.activation.DataHandler;
+import javax.activation.FileDataSource;
+import javax.xml.namespace.QName;
+import javax.xml.ws.soap.MTOMFeature;
+
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public final class MTOMProviderSchemaValidationTest extends
AbstractBusClientServerTestBase {
+ public static final String PORT = Server.PORT;
+
+ private final QName serviceName = new
QName("http://cxf.apache.org/",
"HelloWS");
+
+ @BeforeClass
+ public static void startservers() throws Exception {
+ assertTrue("server did not launch correctly",
launchServer(Server.class, true));
+ }
+ @Test
+ public void testSchemaValidation() throws Exception {
+ HelloWS port = createService();
+ Hello request = new Hello();
+ request.setArg0("value");
+ URL wsdl =
getClass().getResource("/wsdl_systest/mtom_provider_validate.wsdl");
+ File attachment = new File(wsdl.getFile());
+ request.setFile(new DataHandler(new FileDataSource(attachment)));
+ HelloResponse response = port.hello(request);
+ assertEquals("Hello CXF", response.getReturn());
+ }
+
+ private HelloWS createService() throws Exception {
+ URL wsdl =
getClass().getResource("/wsdl_systest/mtom_provider_validate.wsdl");
+ assertNotNull(wsdl);
+
+ HelloWSClient service = new HelloWSClient(wsdl, serviceName);
+ assertNotNull(service);
+
+ HelloWS port = service.getHello(new MTOMFeature());
+
+ updateAddressPort(port, PORT);
+
+ return port;
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/Server.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+
+public class Server extends AbstractBusTestServerBase {
+ public static final String PORT = allocatePort(Server.class);
+ protected void run() {
+
+ System.setProperty("org.apache.cxf.bus.factory",
"org.apache.cxf.bus.CXFBusFactory");
+ System.setProperty("cxf.config.file",
"org/apache/cxf/systest/mtom_schema_validation/cxf.xml");
+
+ TestProvider implementor = new TestProvider();
+ Endpoint ep = Endpoint.create(implementor);
+
((EndpointImpl)ep).setWsdlLocation("wsdl_systest/mtom_provider_validate.wsdl");
+ ep.publish("http://localhost:" + PORT + "/mtom/provider");
+ }
+
+ public static void main(String[] args) throws Exception {
+ try {
+ Server s = new Server();
+ s.start();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ System.exit(-1);
+ } finally {
+ System.out.println("done!");
+ }
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/TestProvider.java 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *
http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.systest.mtom_schema_validation;
+
+import java.io.StringReader;
+
+import javax.jws.soap.SOAPBinding;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceProvider;
+
+import org.xml.sax.InputSource;
+
+@BindingType(value = "http://schemas.xmlsoap.org/wsdl/soap/http")
+@ServiceMode(value = javax.xml.ws.Service.Mode.PAYLOAD)
+@WebServiceProvider(targetNamespace = "http://cxf.apache.org/", serviceName =
"HelloWS", portName = "hello")
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public class TestProvider implements Provider<SAXSource> {
+
+ private String successRsp = "<ns2:helloResponse
xmlns:ns2=\"http://cxf.apache.org/\">"
+ + "<return>Hello CXF</return>" +
"</ns2:helloResponse>";
+
+ public SAXSource invoke(SAXSource request) {
+ return new SAXSource(new InputSource(new StringReader(successRsp)));
+ }
+}
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/cxf.xml
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/cxf.xml
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/java/org/apache/cxf/systest/mtom_schema_validation/cxf.xml 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans
xmlns="http://www.springframework.org/schema/beans"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jaxws="http://cxf.apache.org/jaxws"
+
xmlns:cxf="http://cxf.apache.org/core"
xmlns:soap="http://cxf.apache.org/bindings/soap"
+
xsi:schemaLocation="http://cxf.apache.org/core
http://cxf.apache.org/schemas/core.xsd
+
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
+
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
+
http://cxf.apache.org/bindings/soap
http://cxf.apache.org/schemas/configuration/soap.xsd">
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging />
+ </cxf:features>
+ </cxf:bus>
+ <jaxws:endpoint
id="org.apache.cxf.systest.mtom_schema_validation.TestProvider"
implementor="org.apache.cxf.systest.mtom_schema_validation.TestProvider"
+ wsdlLocation="classpath:/wsdl_systest/mtom_provider_validate.wsdl"
xmlns:hello="http://cxf.apache.org/"
+ serviceName="hello:HelloWS" endpointName="hello:hello"
+ address="/mtom_schema_validation">
+ <jaxws:properties>
+ <entry key="schema-validation-enabled" value="true" />
+ <entry key="mtom-enabled" value="true" />
+ </jaxws:properties>
+ </jaxws:endpoint>
+</beans>
Added:
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
===================================================================
---
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl
(rev 0)
+++
thirdparty/cxf/branches/cxf-2.2.12/systests/uncategorized/src/test/resources/wsdl_systest/mtom_provider_validate.wsdl 2013-09-11
18:56:24 UTC (rev 17915)
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wsdl:definitions
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://cxf.apache.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="HelloWS"
targetNamespace="http://cxf.apache.org/">
+ <wsdl:types>
+ <xs:schema
xmlns:xmime="http://www.w3.org/2005/05/xmlmime"
xmlns:ns1="http://schemas.xmlsoap.org/soap/http"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://cxf.apache.org/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
attributeFormDefault="unqualified" elementFormDefault="unqualified"
targetNamespace="http://cxf.apache.org/">
+ <xs:element name="helloRequest" type="tns:hello"/>
+ <xs:element name="helloResponse"
type="tns:helloResponse"/>
+ <xs:complexType name="hello">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="arg0"
type="xs:string"/>
+ <xs:element name="file" type="xsd:base64Binary"
+ xmime:expectedContentTypes="application/octet-stream" />
+ </xs:sequence>
+ </xs:complexType>
+ <xs:complexType name="helloResponse">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="return"
type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ <xs:element name="ExceptionType"
type="tns:ExceptionType"/>
+ <xs:complexType name="ExceptionType">
+ <xs:sequence>
+ <xs:element minOccurs="0" name="message"
type="xs:string"/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </wsdl:types>
+ <wsdl:message name="helloResponse">
+ <wsdl:part element="tns:helloResponse" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="hello">
+ <wsdl:part element="tns:helloRequest" name="parameters">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:message name="ExceptionType">
+ <wsdl:part element="tns:ExceptionType"
name="ExceptionType">
+ </wsdl:part>
+ </wsdl:message>
+ <wsdl:portType name="HelloWSImpl">
+ <wsdl:operation name="hello">
+ <wsdl:input message="tns:hello" name="hello">
+ </wsdl:input>
+ <wsdl:output message="tns:helloResponse"
name="helloResponse">
+ </wsdl:output>
+ <wsdl:fault message="tns:ExceptionType"
name="ExceptionType">
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:portType>
+ <wsdl:binding name="HelloWSSoapBinding"
type="tns:HelloWSImpl">
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <wsdl:operation name="hello">
+ <soap:operation soapAction="" style="document"/>
+ <wsdl:input name="hello">
+ <soap:body use="literal"/>
+ </wsdl:input>
+ <wsdl:output name="helloResponse">
+ <soap:body use="literal"/>
+ </wsdl:output>
+ <wsdl:fault name="ExceptionType">
+ <soap:fault name="ExceptionType" use="literal"/>
+ </wsdl:fault>
+ </wsdl:operation>
+ </wsdl:binding>
+ <wsdl:service name="HelloWS">
+ <wsdl:port binding="tns:HelloWSSoapBinding" name="hello">
+ <soap:address location="http://localhost:9003/mtom/provider"/>
+ </wsdl:port>
+ </wsdl:service>
+</wsdl:definitions>