Author: richard.opalka(a)jboss.com
Date: 2010-02-19 05:09:59 -0500 (Fri, 19 Feb 2010)
New Revision: 11626
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Echo.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EchoResponse.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Endpoint.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointService.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/JBWS2937TestCase.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ObjectFactory.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ProviderImpl.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/UserType.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/package-info.java
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/real.diff
framework/trunk/testsuite/test/resources/jaxws/jbws2937/
framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/
framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/web.xml
framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/wsdl/
framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/wsdl/Endpoint.wsdl
Modified:
framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
Log:
[JBWS-2937] providing test case for creating Dispatch objects using EPR based
javax.xml.ws.Service.createDispatch(...) methods
Modified: framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml
===================================================================
--- framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2010-02-19 09:57:56 UTC
(rev 11625)
+++ framework/trunk/testsuite/test/ant-import/build-jars-jaxws.xml 2010-02-19 10:09:59 UTC
(rev 11626)
@@ -837,6 +837,21 @@
</fileset>
</jar>
+ <!-- jaxws-jbws2937 -->
+ <jar destfile="${tests.output.dir}/test-libs/jaxws-jbws2937.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include
name="org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.class"/>
+ <include
name="org/jboss/test/ws/jaxws/jbws2937/UserType.class"/>
+ </fileset>
+ </jar>
+
+ <jar
destfile="${tests.output.dir}/test-libs/jaxws-jbws2937-client.jar">
+ <fileset dir="${tests.output.dir}/test-classes">
+ <include name="org/jboss/test/ws/jaxws/jbws2937/*.class"/>
+ <exclude
name="org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.class"/>
+ </fileset>
+ </jar>
+
<!-- jaxws namespace -->
<war warfile="${tests.output.dir}/test-libs/jaxws-namespace.war"
webxml="${tests.output.dir}/test-resources/jaxws/namespace/WEB-INF/web.xml">
<classes dir="${tests.output.dir}/test-classes">
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Echo.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Echo.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Echo.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,62 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for echo complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="echo">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="arg0"
type="{http://jboss.org/jbws2937}UserType" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlRootElement(name = "echo", namespace =
"http://jboss.org/jbws2937")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "echo", propOrder = {
+ "arg0"
+})
+public class Echo {
+
+ protected UserType arg0;
+
+ /**
+ * Gets the value of the arg0 property.
+ *
+ * @return
+ * possible object is
+ * {@link UserType }
+ *
+ */
+ public UserType getArg0() {
+ return arg0;
+ }
+
+ /**
+ * Sets the value of the arg0 property.
+ *
+ * @param value
+ * allowed object is
+ * {@link UserType }
+ *
+ */
+ public void setArg0(UserType value) {
+ this.arg0 = value;
+ }
+
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EchoResponse.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EchoResponse.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EchoResponse.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,64 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for echoResponse complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="echoResponse">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="return"
type="{http://jboss.org/jbws2937}UserType" minOccurs="0"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+@XmlRootElement(name = "echoResponse", namespace =
"http://jboss.org/jbws2937")
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "echoResponse", propOrder = {
+ "_return"
+})
+public class EchoResponse {
+
+ @XmlElement(name = "return")
+ protected UserType _return;
+
+ /**
+ * Gets the value of the return property.
+ *
+ * @return
+ * possible object is
+ * {@link UserType }
+ *
+ */
+ public UserType getReturn() {
+ return _return;
+ }
+
+ /**
+ * Sets the value of the return property.
+ *
+ * @param value
+ * allowed object is
+ * {@link UserType }
+ *
+ */
+ public void setReturn(UserType value) {
+ this._return = value;
+ }
+
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Endpoint.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Endpoint.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/Endpoint.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,36 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+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.2-12/14/2009 02:16 PM(ramkris)-
+ * Generated source version: 2.0
+ *
+ */
+@WebService(name = "Endpoint", targetNamespace =
"http://jboss.org/jbws2937")
+public interface Endpoint {
+
+
+ /**
+ *
+ * @param arg0
+ * @return
+ * returns org.jboss.test.ws.jaxws.jbws2937.UserType
+ */
+ @WebMethod
+ @WebResult(targetNamespace = "")
+ @RequestWrapper(localName = "echo", targetNamespace =
"http://jboss.org/jbws2937", className =
"org.jboss.test.ws.jaxws.jbws2937.Echo")
+ @ResponseWrapper(localName = "echoResponse", targetNamespace =
"http://jboss.org/jbws2937", className =
"org.jboss.test.ws.jaxws.jbws2937.EchoResponse")
+ public UserType echo(
+ @WebParam(name = "arg0", targetNamespace = "")
+ UserType arg0);
+
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointImpl.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,60 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2937;
+
+import javax.jws.WebMethod;
+import javax.jws.WebParam;
+import javax.jws.WebResult;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.jws.soap.SOAPBinding.ParameterStyle;
+
+import javax.ejb.Stateless;
+
+import org.jboss.wsf.spi.annotation.WebContext;
+
+/**
+ * Service implementation.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+@Stateless
+@SOAPBinding
+@WebContext
+(
+ contextRoot="jaxws-jbws2937",
+ urlPattern="/*"
+)
+@WebService
+(
+ name = "Endpoint",
+ serviceName = "EndpointService",
+ targetNamespace = "http://jboss.org/jbws2937"
+)
+public class EndpointImpl
+{
+ @WebMethod
+ public UserType echo(UserType user)
+ {
+ return user;
+ }
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointService.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointService.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/EndpointService.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,65 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+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;
+import javax.xml.ws.WebServiceException;
+
+
+/**
+ * This class was generated by the JAX-WS RI.
+ * JAX-WS RI 2.2-12/14/2009 02:16 PM(ramkris)-
+ * Generated source version: 2.0
+ *
+ */
+@WebServiceClient(name = "EndpointService", targetNamespace =
"http://jboss.org/jbws2937", wsdlLocation =
"file:/opt/svn/jbossas/trunk/build/target/jboss-6.0.0-SNAPSHOT/bin/service.wsdl")
+public class EndpointService
+ extends Service
+{
+
+ private final static URL ENDPOINTSERVICE_WSDL_LOCATION;
+ private final static WebServiceException ENDPOINTSERVICE_EXCEPTION;
+ private final static QName ENDPOINTSERVICE_QNAME = new
QName("http://jboss.org/jbws2937", "EndpointService");
+
+ static {
+ URL url = null;
+ WebServiceException e = null;
+ try {
+ url = new
URL("file:/opt/svn/jbossas/trunk/build/target/jboss-6.0.0-SNAPSHOT/bin/service.wsdl");
+ } catch (MalformedURLException ex) {
+ e = new WebServiceException(ex);
+ }
+ ENDPOINTSERVICE_WSDL_LOCATION = url;
+ ENDPOINTSERVICE_EXCEPTION = e;
+ }
+
+ public EndpointService() {
+ super(__getWsdlLocation(), ENDPOINTSERVICE_QNAME);
+ }
+
+ public EndpointService(URL wsdlLocation, QName serviceName) {
+ super(wsdlLocation, serviceName);
+ }
+
+ /**
+ *
+ * @return
+ * returns Endpoint
+ */
+ @WebEndpoint(name = "EndpointPort")
+ public Endpoint getEndpointPort() {
+ return super.getPort(new
QName("http://jboss.org/jbws2937",
"EndpointPort"), Endpoint.class);
+ }
+
+ private static URL __getWsdlLocation() {
+ if (ENDPOINTSERVICE_EXCEPTION!= null) {
+ throw ENDPOINTSERVICE_EXCEPTION;
+ }
+ return ENDPOINTSERVICE_WSDL_LOCATION;
+ }
+
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/JBWS2937TestCase.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/JBWS2937TestCase.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/JBWS2937TestCase.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2937;
+
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.EndpointReference;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.Service.Mode;
+import javax.xml.ws.soap.AddressingFeature;
+
+import junit.framework.Test;
+
+import org.jboss.wsf.common.DOMUtils;
+import org.jboss.wsf.test.JBossWSTest;
+import org.jboss.wsf.test.JBossWSTestSetup;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * [JBWS-2937] Cannot create dispatch object using EPR based
javax.xml.ws.Service.createDispatch methods.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+public final class JBWS2937TestCase extends JBossWSTest
+{
+ private static final String ENDPOINT_ADDRESS = "http://" + getServerHost() +
":8080/jaxws-jbws2937";
+ private static final WebServiceFeature[] ADDRESSING_ENABLED = { new
AddressingFeature(true) };
+ private static final WebServiceFeature[] ADDRESSING_DISABLED = { new
AddressingFeature(false) };
+ private static final String NAMESPACE_URI = "http://jboss.org/jbws2937";
+ private static final String XML = "<ns1:echo
xmlns:ns1='http://jboss.org/jbws2937'>" +
+ " <arg0>" +
+ " <string>Kermit</string>" +
+ " <qname>TheFrog</qname>" +
+ " </arg0>" +
+ "</ns1:echo>";
+ private static final QName SERVICE_QNAME = new QName(NAMESPACE_URI,
"EndpointService");
+ private static final QName PORT_QNAME = new QName(NAMESPACE_URI,
"EndpointPort");
+ private Service service;
+ private Endpoint proxy;
+ private EndpointReference epr;
+ private UserType user;
+
+ public static Test suite()
+ {
+ return new JBossWSTestSetup(JBWS2937TestCase.class, "jaxws-jbws2937.jar,
jaxws-jbws2937-client.jar");
+ }
+
+ protected void setUp() throws Exception
+ {
+ super.setUp();
+
+ URL wsdlURL = new URL(ENDPOINT_ADDRESS + "?wsdl");
+ this.service = EndpointService.create(wsdlURL, SERVICE_QNAME);
+ this.proxy = (Endpoint)this.service.getPort(PORT_QNAME, Endpoint.class);
+ this.epr = ((BindingProvider)this.proxy).getEndpointReference();
+ // prepare request object
+ this.user = new UserType();
+ this.user.setString("Kermit");
+ this.user.setQname(new QName("TheFrog"));
+ }
+
+ public void testProxy() throws Exception
+ {
+ final UserType response = this.proxy.echo(this.user);
+ assertEquals(this.user, response);
+ }
+
+ public void testCreateDispatchUsingEPRAndSource() throws Exception
+ {
+ Dispatch<Source> dispatch = this.service.createDispatch(PORT_QNAME,
Source.class, Mode.PAYLOAD);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeSourceDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+
+ dispatch = this.service.createDispatch(this.epr, Source.class,
Service.Mode.PAYLOAD, ADDRESSING_ENABLED);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeSourceDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+
+ dispatch = this.service.createDispatch(this.epr, Source.class,
Service.Mode.PAYLOAD, ADDRESSING_DISABLED);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeSourceDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+ }
+
+ public void testCreateDispatchUsingEPRAndJAXBContext() throws Exception
+ {
+ Dispatch<Object> dispatch = this.service.createDispatch(PORT_QNAME,
this.createJAXBContext(), Mode.PAYLOAD);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeObjectDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+
+ dispatch = this.service.createDispatch(this.epr, this.createJAXBContext(),
Service.Mode.PAYLOAD, ADDRESSING_ENABLED);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeObjectDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+
+ dispatch = this.service.createDispatch(this.epr, this.createJAXBContext(),
Service.Mode.PAYLOAD, ADDRESSING_DISABLED);
+ assertNotNull("Dispatch is null", dispatch);
+ this.invokeObjectDispatch(dispatch);
+ this.epr = dispatch.getEndpointReference();
+ printEPR(this.epr);
+ }
+
+ private JAXBContext createJAXBContext()
+ {
+ try
+ {
+ return JAXBContext.newInstance(ObjectFactory.class);
+ }
+ catch (JAXBException e)
+ {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+ }
+
+ private void invokeObjectDispatch(final Dispatch<Object> dispatch) throws
Exception
+ {
+ Echo request = new Echo();
+ request.setArg0(this.user);
+ EchoResponse response = (EchoResponse)dispatch.invoke(request);
+ assertEquals(response.getReturn(), this.user);
+ }
+
+ private void invokeSourceDispatch(final Dispatch<Source> dispatch) throws
Exception
+ {
+ Source request = new StreamSource(new StringReader(XML));
+ Source response = dispatch.invoke(request);
+ verifyResponse(response);
+ }
+
+ private void verifyResponse(final Source result) throws Exception
+ {
+ final Element echoResponseElement = DOMUtils.sourceToElement(result);
+ System.out.println(DOMUtils.node2String(echoResponseElement));
+ assertNotNull("echoResponse element is null", echoResponseElement);
+ // validate return element
+ final Element returnElement = DOMUtils.getFirstChildElement(echoResponseElement);
+ assertNotNull("return element is null", returnElement);
+ assertEquals("return", returnElement.getNodeName());
+ // validate string element
+ final Element stringElement = DOMUtils.getFirstChildElement(returnElement,
"string");
+ assertNotNull("string element is null", stringElement);
+ assertEquals("string", stringElement.getNodeName());
+ assertEquals("Kermit", stringElement.getTextContent());
+ // validate string element
+ final Element qnameElement = DOMUtils.getFirstChildElement(returnElement,
"qname");
+ assertNotNull("qname element is null", qnameElement);
+ assertEquals("qname", qnameElement.getNodeName());
+ assertEquals("TheFrog", qnameElement.getTextContent());
+ }
+
+ private void printEPR(final EndpointReference epr) throws Exception
+ {
+ DOMResult dr = new DOMResult();
+ epr.writeTo(dr);
+ Node endpointReferenceElement = dr.getNode();
+ System.out.println(DOMUtils.node2String(endpointReferenceElement));
+ }
+
+ private void assertEquals(final UserType user1, final UserType user2)
+ {
+ assertEquals("user.string differs", user1.getString(),
user2.getString());
+ assertEquals("user.qname differs", user1.getQname(), user2.getQname());
+ }
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ObjectFactory.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ObjectFactory.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ObjectFactory.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,89 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+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.jbws2937 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 _Echo_QNAME = new
QName("http://jboss.org/jbws2937", "echo");
+ private final static QName _EchoResponse_QNAME = new
QName("http://jboss.org/jbws2937", "echoResponse");
+ private final static QName _User_QNAME = new
QName("http://jboss.org/jbws2937", "user");
+
+ /**
+ * Create a new ObjectFactory that can be used to create new instances of schema
derived classes for package: org.jboss.test.ws.jaxws.jbws2937
+ *
+ */
+ public ObjectFactory() {
+ }
+
+ /**
+ * Create an instance of {@link Echo }
+ *
+ */
+ public Echo createEcho() {
+ return new Echo();
+ }
+
+ /**
+ * Create an instance of {@link UserType }
+ *
+ */
+ public UserType createUserType() {
+ return new UserType();
+ }
+
+ /**
+ * Create an instance of {@link EchoResponse }
+ *
+ */
+ public EchoResponse createEchoResponse() {
+ return new EchoResponse();
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link Echo }{@code >}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jboss.org/jbws2937", name =
"echo")
+ public JAXBElement<Echo> createEcho(Echo value) {
+ return new JAXBElement<Echo>(_Echo_QNAME, Echo.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link EchoResponse }{@code
>}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jboss.org/jbws2937", name =
"echoResponse")
+ public JAXBElement<EchoResponse> createEchoResponse(EchoResponse value) {
+ return new JAXBElement<EchoResponse>(_EchoResponse_QNAME,
EchoResponse.class, null, value);
+ }
+
+ /**
+ * Create an instance of {@link JAXBElement }{@code <}{@link UserType }{@code
>}}
+ *
+ */
+ @XmlElementDecl(namespace = "http://jboss.org/jbws2937", name =
"user")
+ public JAXBElement<UserType> createUser(UserType value) {
+ return new JAXBElement<UserType>(_User_QNAME, UserType.class, null,
value);
+ }
+
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ProviderImpl.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ProviderImpl.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/ProviderImpl.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file 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.jbws2937;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.util.JAXBSource;
+import javax.xml.transform.Source;
+import javax.xml.ws.BindingType;
+import javax.xml.ws.Provider;
+import javax.xml.ws.Service;
+import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
+import javax.xml.ws.WebServiceProvider;
+import javax.xml.ws.http.HTTPBinding;
+
+/**
+ * JAXB based provider.
+ *
+ * @author <a href="mailto:ropalka@redhat.com">Richard Opalka</a>
+ */
+@WebServiceProvider
+(
+ serviceName = "ProviderService",
+ portName = "ProviderPort",
+ targetNamespace = "http://jboss.org/jbws2937",
+ wsdlLocation = "WEB-INF/wsdl/Endpoint.wsdl"
+)
+@BindingType(value = HTTPBinding.HTTP_BINDING)
+@ServiceMode(value = Service.Mode.MESSAGE)
+public class ProviderImpl implements Provider<Source>
+{
+ public Source invoke(final Source request)
+ {
+ try
+ {
+ JAXBContext jc = JAXBContext.newInstance(UserType.class);
+ UserType user = (UserType)jc.createUnmarshaller().unmarshal(request);
+ System.out.println("[string=" + user.getString() + ",qname="
+ user.getQname() + "]");
+ return new JAXBSource(jc, user);
+ }
+ catch (JAXBException e)
+ {
+ throw new WebServiceException(e);
+ }
+ }
+}
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/UserType.java
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/UserType.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/UserType.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,91 @@
+
+package org.jboss.test.ws.jaxws.jbws2937;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.namespace.QName;
+
+
+/**
+ * <p>Java class for UserType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within
this class.
+ *
+ * <pre>
+ * <complexType name="UserType">
+ * <complexContent>
+ * <restriction
base="{http://www.w3.org/2001/XMLSchema}anyType">
+ * <sequence>
+ * <element name="string"
type="{http://www.w3.org/2001/XMLSchema}string"/>
+ * <element name="qname"
type="{http://www.w3.org/2001/XMLSchema}QName"/>
+ * </sequence>
+ * </restriction>
+ * </complexContent>
+ * </complexType>
+ * </pre>
+ *
+ *
+ */
+(a)XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "UserType", propOrder = {
+ "string",
+ "qname"
+})
+public class UserType {
+
+ @XmlElement(required = true)
+ protected String string;
+ @XmlElement(required = true)
+ protected QName qname;
+
+ /**
+ * Gets the value of the string property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getString() {
+ return string;
+ }
+
+ /**
+ * Sets the value of the string property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setString(String value) {
+ this.string = value;
+ }
+
+ /**
+ * Gets the value of the qname property.
+ *
+ * @return
+ * possible object is
+ * {@link QName }
+ *
+ */
+ public QName getQname() {
+ return qname;
+ }
+
+ /**
+ * Sets the value of the qname property.
+ *
+ * @param value
+ * allowed object is
+ * {@link QName }
+ *
+ */
+ public void setQname(QName value) {
+ this.qname = value;
+ }
+
+}
Added:
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/package-info.java
===================================================================
---
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/package-info.java
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/package-info.java 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,2 @@
+(a)javax.xml.bind.annotation.XmlSchema(namespace = "http://jboss.org/jbws2937")
+package org.jboss.test.ws.jaxws.jbws2937;
Added: framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/real.diff
===================================================================
--- framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/real.diff
(rev 0)
+++
framework/trunk/testsuite/test/java/org/jboss/test/ws/jaxws/jbws2937/real.diff 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,6 @@
+6a7
+> import javax.xml.bind.annotation.XmlRootElement;
+30a32
+> @XmlRootElement(namespace = "http://jboss.org/jbws2937", name =
"user")
+90d91
+<
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/web.xml
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/web.xml
(rev 0)
+++ framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/web.xml 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app
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"
+ version="2.4">
+ <servlet>
+ <servlet-name>Provider</servlet-name>
+
<servlet-class>org.jboss.test.ws.jaxws.jbws2937.ProviderImpl</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>Provider</servlet-name>
+ <url-pattern>/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+
Added: framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/wsdl/Endpoint.wsdl
===================================================================
--- framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/wsdl/Endpoint.wsdl
(rev 0)
+++
framework/trunk/testsuite/test/resources/jaxws/jbws2937/WEB-INF/wsdl/Endpoint.wsdl 2010-02-19
10:09:59 UTC (rev 11626)
@@ -0,0 +1,45 @@
+<?xml version='1.0'?>
+<definitions name='ProviderService'
targetNamespace='http://jboss.org/jbws2937'
xmlns='http://schemas.xmlsoap.org/wsdl/'
+
xmlns:mime='http://schemas.xmlsoap.org/wsdl/mime/'
xmlns:tns='http://jboss.org/jbws2937'
xmlns:http='http://schemas.xmlsoap.org/wsdl/http/'
+
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types>
+ <xs:schema
targetNamespace='http://jboss.org/jbws2937'
xmlns:tns='http://jboss.org/jbws2937' version='1.0'
xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+ <xs:element name='user' type='tns:UserType'/>
+ <xs:complexType name='UserType'>
+ <xs:sequence>
+ <xs:element name='string' type='xs:string'/>
+ <xs:element name='qname' type='xs:QName'/>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:schema>
+ </types>
+ <message name='echo'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <message name='echoResponse'>
+ <part element='tns:user' name='user'/>
+ </message>
+ <portType name='Provider'>
+ <operation name='echo'>
+ <input message='tns:echo'/>
+ <output message='tns:echoResponse'/>
+ </operation>
+ </portType>
+ <binding name='ProviderBinding' type='tns:Provider'>
+ <soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
+ <operation name='echo'>
+ <http:operation location='echo'/>
+ <input>
+ <mime:content type="text/xml"/>
+ </input>
+ <output>
+ <mime:content type="text/xml"/>
+ </output>
+ </operation>
+ </binding>
+ <service name='ProviderService'>
+ <port binding='tns:ProviderBinding' name='ProviderPort'>
+ <http:address location='REPLACE_WITH_ACTUAL_URL'/>
+ </port>
+ </service>
+</definitions>