[jbossws-commits] JBossWS SVN: r1303 - in trunk/src: main/java/org/jboss/ws/integration/jboss test/java/org/jboss/test/ws/jaxws/webserviceref

jbossws-commits at lists.jboss.org jbossws-commits at lists.jboss.org
Wed Oct 25 06:23:28 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-10-25 06:23:24 -0400 (Wed, 25 Oct 2006)
New Revision: 1303

Modified:
   trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceRefDeployer.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java
   trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java
Log:
Implement @WebServiceRefs

Modified: trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceRefDeployer.java
===================================================================
--- trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceRefDeployer.java	2006-10-25 06:35:39 UTC (rev 1302)
+++ trunk/src/main/java/org/jboss/ws/integration/jboss/WebServiceRefDeployer.java	2006-10-25 10:23:24 UTC (rev 1303)
@@ -24,6 +24,7 @@
 // $Id$
 
 import javax.naming.Context;
+import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceRef;
 
 import org.jboss.logging.Logger;
@@ -51,10 +52,14 @@
       Class serviceType = ref.value();
       if (serviceType == Object.class)
       {
-         serviceType = targetType;
+         if (targetType != null)
+            serviceType = targetType;
+         else
+            serviceType = Service.class;
       }
       
-      Util.bind(ctx, jndiName, new ServiceReferenceable(serviceType.getName(), targetType.getName(), ref.wsdlLocation()));
-      log.debug("WebServiceRef bound [jndi=" + jndiName + ",type=" + targetType.getName() + "]");
+      String targetTypeName = (targetType != null ? targetType.getName() : null);
+      Util.bind(ctx, jndiName, new ServiceReferenceable(serviceType.getName(), targetTypeName, ref.wsdlLocation()));
+      log.debug("WebServiceRef bound [jndi=" + jndiName + ",type=" + targetTypeName + "]");
    }
 }

Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java	2006-10-25 06:35:39 UTC (rev 1302)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ApplicationClient.java	2006-10-25 10:23:24 UTC (rev 1303)
@@ -23,21 +23,27 @@
 
 import java.util.ArrayList;
 
+import javax.naming.InitialContext;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
 
 import org.jboss.logging.Logger;
 
+ at WebServiceRef(name = "service1", value = TestEndpointService.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+ at WebServiceRefs( { 
+   @WebServiceRef(name = "service2", value = TestEndpointService.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl"),
+   @WebServiceRef(name = "port1", value = TestEndpointService.class, type = TestEndpoint.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl") })
 public class ApplicationClient
 {
    // Provide logging
    private static Logger log = Logger.getLogger(ApplicationClient.class);
    
    @WebServiceRef (name ="TestEndpointService", wsdlLocation ="META-INF/wsdl/TestEndpoint.wsdl")
-   public static TestEndpointService service;
+   public static TestEndpointService service3;
 
    @WebServiceRef (value = TestEndpointService.class, wsdlLocation ="META-INF/wsdl/TestEndpoint.wsdl")
-   public static TestEndpoint port;
+   public static TestEndpoint port2;
    
    public static String retStr;
    
@@ -47,8 +53,19 @@
       log.info("echo: " + inStr);
       
       ArrayList<TestEndpoint> ports = new ArrayList<TestEndpoint>();
-      ports.add((TestEndpoint)service.getPort(TestEndpoint.class));
-      ports.add(port);
+      try
+      {
+         InitialContext iniCtx = new InitialContext();
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
+         ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
+         //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/port1"));
+         ports.add(port2);
+      }
+      catch (Exception ex)
+      {
+         throw new WebServiceException(ex);
+      }
       
       for (TestEndpoint port : ports)
       {

Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java	2006-10-25 06:35:39 UTC (rev 1302)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/EJB3Client.java	2006-10-25 10:23:24 UTC (rev 1303)
@@ -1,32 +1,34 @@
 /*
-  * 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.
-  */
+ * 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.webserviceref;
 
 import java.util.ArrayList;
 
 import javax.ejb.Remote;
 import javax.ejb.Stateless;
+import javax.naming.InitialContext;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
 
 import org.jboss.annotation.ejb.RemoteBinding;
 import org.jboss.logging.Logger;
@@ -35,32 +37,48 @@
 @Remote(EJB3Remote.class)
 @RemoteBinding(jndiBinding = "/ejb3/EJB3Client")
 @Stateless
+
+ at WebServiceRef(name = "service1", value = TestEndpointService.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+ at WebServiceRefs( { 
+   @WebServiceRef(name = "service2", value = TestEndpointService.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl"),
+   @WebServiceRef(name = "port1", value = TestEndpointService.class, type = TestEndpoint.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl") })
 public class EJB3Client implements EJB3Remote
 {
    // Provide logging
    private static Logger log = Logger.getLogger(EJB3Client.class);
-   
-   @WebServiceRef (name ="TestEndpointService", wsdlLocation ="META-INF/wsdl/TestEndpoint.wsdl")
-   public TestEndpointService service;
-   
-   @WebServiceRef (value = TestEndpointService.class, wsdlLocation ="META-INF/wsdl/TestEndpoint.wsdl")
-   public TestEndpoint port;
-   
+
+   @WebServiceRef(name = "TestEndpointService", wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+   public TestEndpointService service3;
+
+   @WebServiceRef(value = TestEndpointService.class, wsdlLocation = "META-INF/wsdl/TestEndpoint.wsdl")
+   public TestEndpoint port2;
+
    public String echo(String inStr)
    {
       log.info("echo: " + inStr);
-      
+
       ArrayList<TestEndpoint> ports = new ArrayList<TestEndpoint>();
-      ports.add((TestEndpoint)service.getPort(TestEndpoint.class));
-      ports.add(port);
-      
+      try
+      {
+         InitialContext iniCtx = new InitialContext();
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
+         ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
+         //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/port1"));
+         ports.add(port2);
+      }
+      catch (Exception ex)
+      {
+         throw new WebServiceException(ex);
+      }
+
       for (TestEndpoint port : ports)
       {
          String outStr = port.echo(inStr);
          if (inStr.equals(outStr) == false)
             throw new WebServiceException("Invalid echo return: " + inStr);
       }
-      
+
       return inStr;
    }
 }

Modified: trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java
===================================================================
--- trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java	2006-10-25 06:35:39 UTC (rev 1302)
+++ trunk/src/test/java/org/jboss/test/ws/jaxws/webserviceref/ServletClient.java	2006-10-25 10:23:24 UTC (rev 1303)
@@ -24,25 +24,31 @@
 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.WebServiceException;
 import javax.xml.ws.WebServiceRef;
+import javax.xml.ws.WebServiceRefs;
 
 import org.jboss.logging.Logger;
 
+ at WebServiceRef(name = "service1", value = TestEndpointService.class, wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl")
+ at WebServiceRefs( { 
+   @WebServiceRef(name = "service2", value = TestEndpointService.class, wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl"),
+   @WebServiceRef(name = "port1", value = TestEndpointService.class, type = TestEndpoint.class, wsdlLocation = "WEB-INF/wsdl/TestEndpoint.wsdl") })
 public class ServletClient extends HttpServlet
 {
    // Provide logging
    private static Logger log = Logger.getLogger(ServletClient.class);
    
    @WebServiceRef (name ="TestEndpointService", wsdlLocation ="WEB-INF/wsdl/TestEndpoint.wsdl")
-   public TestEndpointService service;
+   public TestEndpointService service3;
    
    @WebServiceRef (value = TestEndpointService.class, wsdlLocation ="WEB-INF/wsdl/TestEndpoint.wsdl")
-   public TestEndpoint port;
+   public TestEndpoint port2;
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
@@ -51,8 +57,19 @@
       log.info("doGet: " + inStr);
       
       ArrayList<TestEndpoint> ports = new ArrayList<TestEndpoint>();
-      ports.add((TestEndpoint)service.getPort(TestEndpoint.class));
-      ports.add(port);
+      try
+      {
+         InitialContext iniCtx = new InitialContext();
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service1")).getTestEndpointPort());
+         //ports.add(((TestEndpointService)iniCtx.lookup("java:comp/env/service2")).getTestEndpointPort());
+         ports.add((TestEndpoint)service3.getPort(TestEndpoint.class));
+         //ports.add((TestEndpoint)iniCtx.lookup("java:comp/env/port1"));
+         ports.add(port2);
+      }
+      catch (Exception ex)
+      {
+         throw new WebServiceException(ex);
+      }
       
       for (TestEndpoint port : ports)
       {




More information about the jbossws-commits mailing list