[jbossws-commits] JBossWS SVN: r2602 - in trunk: jbossws-core/src/java/org/jboss/ws/core/jaxws/client and 7 other directories.

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Mon Mar 12 13:10:30 EDT 2007


Author: thomas.diesler at jboss.com
Date: 2007-03-12 13:10:29 -0400 (Mon, 12 Mar 2007)
New Revision: 2602

Added:
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBClient.java
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBRemote.java
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefEJBTestCase.java
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefServletTestCase.java
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServletClient.java
Removed:
   trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/webservices.xml
   trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-java-wsdl.xml
   trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-wsdl-java.xml
Modified:
   trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
   trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java
   trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
   trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
   trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefClientTestCase.java
   trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/application-client.xml
   trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/ejb-jar.xml
   trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl
   trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/web.xml
   trunk/jbossws-tests/src/resources/jaxws/serviceref/servlet-client/WEB-INF/web.xml
Log:
Add more jaxws <service-ref> tests

Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/client/ServiceRefHandlerImpl.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -24,6 +24,8 @@
 // $Id$
 
 import java.lang.reflect.AnnotatedElement;
+import java.net.URL;
+import java.net.URLClassLoader;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -36,6 +38,7 @@
 import org.jboss.ws.integration.ServiceRefMetaData;
 import org.jboss.ws.integration.UnifiedVirtualFile;
 import org.jboss.ws.metadata.j2ee.serviceref.UnifiedServiceRefMetaData;
+import org.jboss.ws.metadata.umdm.EndpointMetaData.Type;
 import org.jboss.xb.binding.UnmarshallingContext;
 import org.xml.sax.Attributes;
 
@@ -70,7 +73,7 @@
       serviceRef.setVfsRoot(vfsRoot);
       try
       {
-         if (isServiceRefJaxRpc(serviceRef))
+         if (getServiceRefType(serviceRef) == Type.JAXRPC)
          {
             ServiceRefHandlerJAXRPC handler = new ServiceRefHandlerJAXRPC();
             handler.setupServiceRef(encCtx, encName, serviceRef);
@@ -98,10 +101,36 @@
       objectFactory.setValue(ref, navigator, namespaceURI, localName, value);
    }
 
-   private boolean isServiceRefJaxRpc(UnifiedServiceRefMetaData serviceRef)
+   private Type getServiceRefType(UnifiedServiceRefMetaData serviceRef) throws NamingException
    {
-      // The <service-interface> is a required element 
-      // for JAXRPC and not defined for JAXWS
-      return serviceRef.getServiceInterface() != null;
+      // The service-ref-type is JAXWS specific
+      String serviceRefType = serviceRef.getServiceRefType();
+      if (serviceRefType != null)
+         return Type.JAXWS;
+         
+      String siName = serviceRef.getServiceInterface();
+      if (siName == null)
+         throw new IllegalStateException("<service-interface> cannot be null");
+
+      ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();
+      URL rootURL = serviceRef.getVfsRoot().toURL();
+      URLClassLoader loader = new URLClassLoader(new URL[] {rootURL}, ctxLoader);
+      
+      Class siClass;
+      try
+      {
+         siClass = loader.loadClass(siName);
+      }
+      catch (ClassNotFoundException e)
+      {
+         throw new NamingException("Cannot load service-endpoint-interface: " + siName);
+      }
+      
+      if (javax.xml.ws.Service.class.isAssignableFrom(siClass))
+         return Type.JAXWS;
+      else if (javax.xml.rpc.Service.class.isAssignableFrom(siClass))
+         return Type.JAXRPC;
+      else
+         throw new IllegalStateException("Illegal service interface: " + siName);
    }
 }

Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceObjectFactory.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -104,7 +104,7 @@
          if (Service.class.getName().equals(targetClassName))
             targetClassName = serviceImplClass;
          
-         if(log.isDebugEnabled()) log.debug("[name=" + serviceRefName + ",service=" + serviceImplClass + ",target=" + targetClassName + "]");
+         log.debug("[name=" + serviceRefName + ",service=" + serviceImplClass + ",target=" + targetClassName + "]");
 
          // Load the service class
          ClassLoader ctxLoader = Thread.currentThread().getContextClassLoader();

Modified: trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java
===================================================================
--- trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-core/src/java/org/jboss/ws/core/jaxws/client/ServiceRefHandlerJAXWS.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -113,7 +113,11 @@
       if (serviceImplClass == null && targetClass != null && Service.class.isAssignableFrom(targetClass))
          serviceImplClass = targetClass.getName();
 
-      // #3 Use javax.xml.ws.Service 
+      // #3 Use <service-interface> 
+      if (serviceImplClass == null && serviceRef.getServiceInterface() != null)
+         serviceImplClass = serviceRef.getServiceInterface();
+
+      // #4 Use javax.xml.ws.Service 
       if (serviceImplClass == null)
          serviceImplClass = Service.class.getName();
 

Modified: trunk/jbossws-tests/ant-import/build-jars-jaxws.xml
===================================================================
--- trunk/jbossws-tests/ant-import/build-jars-jaxws.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/ant-import/build-jars-jaxws.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -238,6 +238,40 @@
         <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpointImpl.class"/>
       </classes>
     </war>
+    <jar destfile="${tests.output.dir}/libs/jaxws-serviceref-client.jar">
+      <fileset dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/serviceref/ApplicationClient.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpointService.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpoint.class"/>
+      </fileset>
+      <metainf dir="${tests.output.dir}/resources/jaxws/serviceref/META-INF">
+        <include name="application-client.xml"/>
+        <include name="jboss-client.xml"/>
+        <include name="wsdl/**"/>
+      </metainf>
+    </jar>
+    <war destfile="${tests.output.dir}/libs/jaxws-serviceref-servlet-client.war" webxml="${tests.output.dir}/resources/jaxws/serviceref/servlet-client/WEB-INF/web.xml">
+      <classes dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/serviceref/ServletClient.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpointService.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpoint.class"/>
+      </classes>
+      <webinf dir="${tests.output.dir}/resources/jaxws/serviceref/META-INF">
+        <include name="wsdl/**"/>
+      </webinf>
+    </war>
+    <jar destfile="${tests.output.dir}/libs/jaxws-serviceref-ejb-client.jar">
+      <fileset dir="${tests.output.dir}/classes">
+        <include name="org/jboss/test/ws/jaxws/serviceref/EJBClient.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/EJBRemote.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpointService.class"/>
+        <include name="org/jboss/test/ws/jaxws/serviceref/TestEndpoint.class"/>
+      </fileset>
+      <metainf dir="${tests.output.dir}/resources/jaxws/serviceref/META-INF">
+        <include name="ejb-jar.xml"/>
+        <include name="wsdl/**"/>
+      </metainf>
+    </jar>
     
     <!-- jaxws-wrapped-accessor -->
     <war warfile="${tests.output.dir}/libs/jaxws-wrapped-accessor.war" webxml="${tests.output.dir}/resources/jaxws/wrapped/accessor/WEB-INF/web.xml">

Added: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBClient.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBClient.java	                        (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBClient.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -0,0 +1,72 @@
+/*
+ * 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.serviceref;
+
+import java.rmi.RemoteException;
+import java.util.ArrayList;
+
+import javax.ejb.Remote;
+import javax.ejb.Stateless;
+import javax.naming.InitialContext;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.annotation.ejb.RemoteBinding;
+import org.jboss.logging.Logger;
+
+ at Remote(EJBRemote.class)
+ at RemoteBinding(jndiBinding = "/ejb/EJBClient")
+ at Stateless
+
+public class EJBClient 
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(EJBClient.class);
+
+   public String echo(String inStr) throws RemoteException
+   {
+      log.info("echo: " + inStr);
+
+      ArrayList ports = new ArrayList();
+      try
+      {
+         InitialContext iniCtx = new InitialContext();
+         ports.add((TestEndpoint)((Service)iniCtx.lookup("java:comp/env/service1")).getPort(TestEndpoint.class));
+         ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
+      }
+      catch (Exception ex)
+      {
+         log.error("Cannot add port", ex);
+         throw new WebServiceException(ex);
+      }
+
+      for (int i = 0; i < ports.size(); i++)
+      {
+         TestEndpoint port = (TestEndpoint)ports.get(i);
+         String outStr = port.echo(inStr);
+         if (inStr.equals(outStr) == false)
+            throw new WebServiceException("Invalid echo return: " + inStr);
+      }
+
+      return inStr;
+   }
+}


Property changes on: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBClient.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBRemote.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBRemote.java	                        (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBRemote.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -0,0 +1,28 @@
+/*
+  * 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.serviceref;
+
+
+public interface EJBRemote
+{
+   String echo(String input);
+}


Property changes on: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/EJBRemote.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefClientTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefClientTestCase.java	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefClientTestCase.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -47,7 +47,7 @@
 
    public static Test suite()
    {
-      return JBossWSTestSetup.newTestSetup(ServiceRefClientTestCase.class, "jaxws-serviceref.war"); //ant , jaxws-serviceref-client.jar");
+      return JBossWSTestSetup.newTestSetup(ServiceRefClientTestCase.class, "jaxws-serviceref.war, jaxws-serviceref-client.jar");
    }
 
    public void testWSDLAccess() throws MalformedURLException

Added: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefEJBTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefEJBTestCase.java	                        (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefEJBTestCase.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -0,0 +1,85 @@
+/*
+ * 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.serviceref;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+
+/**
+ * Test the JAXRPC <service-ref>
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 23-Oct-2005
+ */
+public class ServiceRefEJBTestCase extends JBossWSTest
+{
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-serviceref";
+   
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(ServiceRefEJBTestCase.class, "jaxws-serviceref.war, jaxws-serviceref-ejb-client.jar");
+   }
+
+   public void testWSDLAccess() throws MalformedURLException
+   {
+      URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+      WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+      WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+      assertNotNull(wsdlDefinitions);
+   }
+   
+   public void testDynamicProxy() throws Exception
+   {
+      URL wsdlURL = new File("resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl").toURL();
+      QName qname = new QName("http://serviceref.jaxws.ws.test.jboss.org/", "TestEndpointService");
+      Service service = Service.create(wsdlURL, qname);
+      TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
+
+      String helloWorld = "Hello World!";
+      Object retObj = port.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
+   }
+
+
+   public void testEJBClient() throws Exception
+   {
+      InitialContext iniCtx = getInitialContext();
+      EJBRemote ejbRemote = (EJBRemote)iniCtx.lookup("/ejb/EJBClient");
+
+      String helloWorld = "Hello World!";
+      Object retObj = ejbRemote.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
+      
+   }
+}


Property changes on: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefEJBTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefServletTestCase.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefServletTestCase.java	                        (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefServletTestCase.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -0,0 +1,82 @@
+/*
+ * 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.serviceref;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.Service;
+
+import junit.framework.Test;
+
+import org.jboss.test.ws.JBossWSTest;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
+import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
+
+/**
+ * Test the jaxws <service-ref>
+ *
+ * @author Thomas.Diesler at jboss.com
+ * @since 23-Oct-2005
+ */
+public class ServiceRefServletTestCase extends JBossWSTest
+{
+   public final String TARGET_ENDPOINT_ADDRESS = "http://" + getServerHost() + ":8080/jaxws-serviceref";
+   
+   public static Test suite()
+   {
+      return JBossWSTestSetup.newTestSetup(ServiceRefServletTestCase.class, "jaxws-serviceref.war, jaxws-serviceref-servlet-client.war");
+   }
+
+   public void testWSDLAccess() throws MalformedURLException
+   {
+      URL wsdlURL = new URL(TARGET_ENDPOINT_ADDRESS + "?wsdl");
+      WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
+      WSDLDefinitions wsdlDefinitions = factory.parse(wsdlURL);
+      assertNotNull(wsdlDefinitions);
+   }
+   
+   public void testDynamicProxy() throws Exception
+   {
+      URL wsdlURL = new File("resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl").toURL();
+      QName qname = new QName("http://serviceref.jaxws.ws.test.jboss.org/", "TestEndpointService");
+      Service service = Service.create(wsdlURL, qname);
+      TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
+
+      String helloWorld = "Hello World!";
+      Object retObj = port.echo(helloWorld);
+      assertEquals(helloWorld, retObj);
+   }
+
+   public void testServletClient() throws Exception
+   {
+      URL url = new URL(TARGET_ENDPOINT_ADDRESS + "-servlet-client?echo=HelloWorld");
+      BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
+      String retStr = br.readLine();
+      assertEquals("HelloWorld", retStr);
+   }
+}


Property changes on: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServiceRefServletTestCase.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServletClient.java
===================================================================
--- trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServletClient.java	                        (rev 0)
+++ trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServletClient.java	2007-03-12 17:10:29 UTC (rev 2602)
@@ -0,0 +1,70 @@
+/*
+ * 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.serviceref;
+
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.naming.InitialContext;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+
+public class ServletClient extends HttpServlet
+{
+   // Provide logging
+   private static Logger log = Logger.getLogger(ServletClient.class);
+
+   protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
+   {
+      String inStr = req.getParameter("echo");
+      log.info("doGet: " + inStr);
+
+      ArrayList ports = new ArrayList();
+      try
+      {
+         InitialContext iniCtx = new InitialContext();
+         ports.add((TestEndpoint)((Service)iniCtx.lookup("java:comp/env/service1")).getPort(TestEndpoint.class));
+         ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
+      }
+      catch (Exception ex)
+      {
+         log.error("Cannot add port", ex);
+         throw new WebServiceException(ex);
+      }
+
+      for (int i = 0; i < ports.size(); i++)
+      {
+         TestEndpoint port = (TestEndpoint)ports.get(i);
+         String outStr = port.echo(inStr);
+         if (inStr.equals(outStr) == false)
+            throw new WebServiceException("Invalid echo return: " + inStr);
+      }
+
+      res.getWriter().print(inStr);
+   }
+}


Property changes on: trunk/jbossws-tests/src/java/org/jboss/test/ws/jaxws/serviceref/ServletClient.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/application-client.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/application-client.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/application-client.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,30 +1,21 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<application-client 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/application-client_1_4.xsd"
-  version="1.4">
+<application-client version="5" xmlns="http://java.sun.com/xml/ns/javaee" 
+  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_5.xsd">
 
-  <display-name>JAXRPC simple tests</display-name>
+  <display-name>jaxws simple tests</display-name>
 
   <service-ref>
     <service-ref-name>service1</service-ref-name>
-    <service-interface>javax.xml.rpc.Service</service-interface>
+    <service-interface>javax.xml.ws.Service</service-interface>
     <wsdl-file>META-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-    <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-    <port-component-ref>
-      <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-    </port-component-ref>
   </service-ref>
 
   <service-ref>
     <service-ref-name>service2</service-ref-name>
-    <service-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpointService</service-interface>
+    <service-interface>org.jboss.test.ws.jaxws.serviceref.TestEndpointService</service-interface>
     <wsdl-file>META-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-    <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-    <port-component-ref>
-      <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-    </port-component-ref>
   </service-ref>
 
 </application-client>

Modified: trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/ejb-jar.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/ejb-jar.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/ejb-jar.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,37 +1,28 @@
 <?xml version="1.0" encoding="UTF-8"?>
 
-<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee"
+<ejb-jar xmlns="http://java.sun.com/xml/ns/javaee"
   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/ejb-jar_2_1.xsd"
-  version="2.1">
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/j2ee/ejb-jar_3_0.xsd"
+  version="3.0">
 
   <enterprise-beans>
     <session>
-      <ejb-name>ejb/EJBClient</ejb-name>
-      <home>org.jboss.test.ws.jaxrpc.serviceref.EJBRemoteHome</home>
-      <remote>org.jboss.test.ws.jaxrpc.serviceref.EJBRemote</remote>
-      <ejb-class>org.jboss.test.ws.jaxrpc.serviceref.EJBClient</ejb-class>
+      <ejb-name>EJBClient</ejb-name>
+      <remote>org.jboss.test.ws.jaxws.serviceref.EJBRemote</remote>
+      <ejb-class>org.jboss.test.ws.jaxws.serviceref.EJBClient</ejb-class>
       <session-type>Stateless</session-type>
       <transaction-type>Container</transaction-type>
       
       <service-ref>
         <service-ref-name>service1</service-ref-name>
-        <service-interface>javax.xml.rpc.Service</service-interface>
+        <service-interface>javax.xml.ws.Service</service-interface>
         <wsdl-file>META-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-        <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-        <port-component-ref>
-          <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-        </port-component-ref>
       </service-ref>
-      
+    
       <service-ref>
         <service-ref-name>service2</service-ref-name>
-        <service-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpointService</service-interface>
+        <service-interface>org.jboss.test.ws.jaxws.serviceref.TestEndpointService</service-interface>
         <wsdl-file>META-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-        <jaxrpc-mapping-file>META-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-        <port-component-ref>
-          <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-        </port-component-ref>
       </service-ref>
       
     </session>

Modified: trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/META-INF/wsdl/TestEndpoint.wsdl	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,14 +1,13 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<definitions name='TestEndpointService' targetNamespace='http://org.jboss.ws/wsref' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://org.jboss.ws/wsref' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
- <types/>
- <message name='TestEndpoint_echo'>
-  <part name='String_1' type='xsd:string'/>
- </message>
+<definitions name='TestEndpointService' targetNamespace='http://serviceref.jaxws.ws.test.jboss.org/' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://serviceref.jaxws.ws.test.jboss.org/' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+ <types></types>
  <message name='TestEndpoint_echoResponse'>
-  <part name='result' type='xsd:string'/>
+  <part name='return' type='xsd:string'/>
  </message>
+ <message name='TestEndpoint_echo'>
+  <part name='arg0' type='xsd:string'/>
+ </message>
  <portType name='TestEndpoint'>
-  <operation name='echo' parameterOrder='String_1'>
+  <operation name='echo' parameterOrder='arg0'>
    <input message='tns:TestEndpoint_echo'/>
    <output message='tns:TestEndpoint_echoResponse'/>
   </operation>
@@ -18,16 +17,16 @@
   <operation name='echo'>
    <soap:operation soapAction=''/>
    <input>
-    <soap:body namespace='http://org.jboss.ws/wsref' use='literal'/>
+    <soap:body namespace='http://serviceref.jaxws.ws.test.jboss.org/' use='literal'/>
    </input>
    <output>
-    <soap:body namespace='http://org.jboss.ws/wsref' use='literal'/>
+    <soap:body namespace='http://serviceref.jaxws.ws.test.jboss.org/' use='literal'/>
    </output>
   </operation>
  </binding>
  <service name='TestEndpointService'>
   <port binding='tns:TestEndpointBinding' name='TestEndpointPort'>
-   <soap:address location='http://@jbosstest.host.name@:8080/jaxrpc-serviceref'/>
+   <soap:address location='http://@jbosstest.host.name@:8080/jaxws-serviceref'/>
   </port>
  </service>
 </definitions>
\ No newline at end of file

Modified: trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/web.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/web.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/web.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -5,7 +5,7 @@
   
   <servlet>
     <servlet-name>TestEndpoint</servlet-name>
-    <servlet-class>org.jboss.test.ws.jaxrpc.serviceref.TestEndpointImpl</servlet-class>
+    <servlet-class>org.jboss.test.ws.jaxws.serviceref.TestEndpointImpl</servlet-class>
   </servlet>
   
   <servlet-mapping>

Deleted: trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/webservices.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/webservices.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/WEB-INF/webservices.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,15 +0,0 @@
-<webservices version='1.1' xmlns='http://java.sun.com/xml/ns/j2ee' xmlns:impl='http://org.jboss.ws/wsref' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd'>
- <webservice-description>
-  <webservice-description-name>TestEndpointService</webservice-description-name>
-  <wsdl-file>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-  <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-  <port-component>
-   <port-component-name>TestEndpointPort</port-component-name>
-   <wsdl-port>impl:TestEndpointPort</wsdl-port>
-   <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-   <service-impl-bean>
-    <servlet-link>TestEndpoint</servlet-link>
-   </service-impl-bean>
-  </port-component>
- </webservice-description>
-</webservices>
\ No newline at end of file

Modified: trunk/jbossws-tests/src/resources/jaxws/serviceref/servlet-client/WEB-INF/web.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/servlet-client/WEB-INF/web.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/servlet-client/WEB-INF/web.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,11 +1,11 @@
 <?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">
+  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/j2ee/web-app_2_5.xsd">
   
   <servlet>
     <servlet-name>ServletClient</servlet-name>
-    <servlet-class>org.jboss.test.ws.jaxrpc.serviceref.ServletClient</servlet-class>
+    <servlet-class>org.jboss.test.ws.jaxws.serviceref.ServletClient</servlet-class>
   </servlet>
   
   <servlet-mapping>
@@ -15,22 +15,14 @@
   
   <service-ref>
     <service-ref-name>service1</service-ref-name>
-    <service-interface>javax.xml.rpc.Service</service-interface>
+    <service-interface>javax.xml.ws.Service</service-interface>
     <wsdl-file>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-    <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-    <port-component-ref>
-      <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-    </port-component-ref>
   </service-ref>
 
   <service-ref>
     <service-ref-name>service2</service-ref-name>
-    <service-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpointService</service-interface>
+    <service-interface>org.jboss.test.ws.jaxws.serviceref.TestEndpointService</service-interface>
     <wsdl-file>WEB-INF/wsdl/TestEndpoint.wsdl</wsdl-file>
-    <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
-    <port-component-ref>
-      <service-endpoint-interface>org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint</service-endpoint-interface>
-    </port-component-ref>
   </service-ref>
   
 </web-app>
\ No newline at end of file

Deleted: trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-java-wsdl.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-java-wsdl.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-java-wsdl.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-   wstools -cp ../../../../../output/classes -config wstools-java-wsdl.xml
--->
-
-<configuration xmlns="http://www.jboss.org/jbossws-tools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
-  
-  <global>
-    <package-namespace package="org.jboss.test.ws.jaxrpc.serviceref" namespace="http://org.jboss.ws/wsref"/>
-  </global>
-  
-  <java-wsdl>
-    <service name="TestEndpointService" style="rpc" endpoint="org.jboss.test.ws.jaxrpc.serviceref.TestEndpoint"/>
-    <namespaces target-namespace="http://org.jboss.ws/wsref" type-namespace="http://org.jboss.ws/wsref/types"/>
-    <mapping file="jaxrpc-mapping.xml"/>
-    <webservices servlet-link="TestEndpoint"/>
-  </java-wsdl>
-  
-</configuration>
\ No newline at end of file

Deleted: trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-wsdl-java.xml
===================================================================
--- trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-wsdl-java.xml	2007-03-12 14:34:08 UTC (rev 2601)
+++ trunk/jbossws-tests/src/resources/jaxws/serviceref/wstools-wsdl-java.xml	2007-03-12 17:10:29 UTC (rev 2602)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
-   wstools -config wstools-wsdl-java.xml
--->
-
-<configuration xmlns="http://www.jboss.org/jbossws-tools" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-  xsi:schemaLocation="http://www.jboss.org/jbossws-tools http://www.jboss.org/jbossws-tools/schema/jbossws-tool_1_0.xsd">
-  
-  <global>
-    <package-namespace package="org.jboss.test.ws.jaxrpc.serviceref" namespace="http://org.jboss.ws/wsref"/>
-  </global>
-  
-  <wsdl-java location="META-INF/wsdl/TestEndpoint.wsdl">
-    <mapping file="jaxrpc-mapping.xml"/>
-  </wsdl-java>
-  
-</configuration>
\ No newline at end of file




More information about the jbossws-commits mailing list