[jboss-svn-commits] JBossWS SVN: r1052 - in branches/tdiesler/trunk: . src/main/java/org/jboss/ws/addressing/jaxrpc src/main/java/org/jboss/ws/addressing/jaxws src/main/java/org/jboss/ws/common src/main/java/org/jboss/ws/deployment src/main/java/org/jboss/ws/jaxrpc src/main/java/org/jboss/ws/jaxws/client src/main/java/org/jboss/ws/jaxws/spi src/main/java/org/jboss/ws/metadata src/main/java/org/jboss/ws/server src/main/java/org/jboss/ws/tools/helpers src/main/java/org/jboss/ws/tools/metadata

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Tue Sep 26 04:50:13 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-09-26 04:49:54 -0400 (Tue, 26 Sep 2006)
New Revision: 1052

Added:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
Removed:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
Modified:
   branches/tdiesler/trunk/ant.properties.example
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
Log:
Conformance requirements

Modified: branches/tdiesler/trunk/ant.properties.example
===================================================================
--- branches/tdiesler/trunk/ant.properties.example	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/ant.properties.example	2006-09-26 08:49:54 UTC (rev 1052)
@@ -3,7 +3,7 @@
 #
 
 # Required JBoss Home
-#jboss.jdk15.home=/home/tdiesler/svn/jboss/jbossas/trunk/build/output/jboss-5.0.0.Beta
+#jboss.jdk15.home=/home/tdiesler/svn/jboss/jbossas/branches/JEE5_TCK/build/output/jboss-5.0.0.Beta
 
 
 # Optional JBoss Home

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxrpc/WSAddressingServerHandler.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -139,7 +139,7 @@
 
          OperationMetaData opMetaData = ((SOAPMessageContextJAXRPC)msgContext).getOperationMetaData();
 
-         if (!isFault && !opMetaData.isOneWayOperation())
+         if (!isFault && !opMetaData.isOneWay())
          {
 
             AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/addressing/jaxws/WSAddressingServerHandler.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -121,7 +121,7 @@
 
          OperationMetaData opMetaData = ((CommonMessageContext)msgContext).getOperationMetaData();
 
-         if (!isFault && !opMetaData.isOneWayOperation())
+         if (!isFault && !opMetaData.isOneWay())
          {
 
             AddressingOpMetaExt addrExt = (AddressingOpMetaExt)opMetaData.getExtension(ADDR_CONSTANTS.getNamespaceURI());

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -25,12 +25,10 @@
 
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.rmi.RemoteException;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.rpc.ParameterMode;
-import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.ws.addressing.AddressingProperties;
@@ -156,10 +154,9 @@
       return getOperationMetaData(operationName);
    }
 
-   /** Get the OperationMetaData for the given operation name
-    * If it does not exist, it will be created
-    */
-   public OperationMetaData getOperationMetaData(QName opName)
+   // Get the OperationMetaData for the given operation name
+   // If it does not exist, it will be created
+   private OperationMetaData getOperationMetaData(QName opName)
    {
       if (opName == null)
          throw new IllegalArgumentException("Cannot get OperationMetaData for null");
@@ -213,12 +210,13 @@
     * 6) unwrap the result using the BindingProvider
     * 7) return the result
     */
-   protected Object invoke(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, Map<String, Object> resContext, boolean oneway) throws RemoteException
+   protected Object invoke(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, Map<String, Object> resContext, boolean forceOneway) throws Exception
    {
       if (opName.equals(operationName) == false)
          setOperationName(opName);
 
       OperationMetaData opMetaData = getOperationMetaData();
+      boolean oneway = forceOneway || opMetaData.isOneWay();
 
       // Associate a message context with the current thread
       CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
@@ -328,16 +326,6 @@
 
          return retObj;
       }
-      catch (SOAPFaultException ex)
-      {
-         log.error("Call invocation failed", ex);
-         String faultCode = ex.getFaultCode().getLocalPart();
-         throw new RemoteException("Call invocation failed with code [" + faultCode + "] because of: " + ex.getFaultString(), ex);
-      }
-      catch (Exception ex)
-      {
-         throw new RemoteException("Call invocation failed", ex);
-      }
       finally
       {
          resContext.putAll(msgContext.getProperties());

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -379,7 +379,7 @@
 
          // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
          // Specifically, the HTTP response entity-body must be empty.
-         if (opMetaData.isOneWayOperation())
+         if (opMetaData.isOneWay())
          {
             resMessage.getSOAPPart().setContent(null);
             return resMessage;
@@ -504,7 +504,7 @@
       {
          // R2714 For one-way operations, an INSTANCE MUST NOT return a HTTP response that contains a SOAP envelope.
          // Specifically, the HTTP response entity-body must be empty.
-         if (opMetaData.isOneWayOperation() == true)
+         if (opMetaData.isOneWay() == true)
          {
             return;
          }

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JSR181MetaDataBuilder.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -365,7 +365,7 @@
          if (requestWrapperType == null)
             ParameterWrapping.generateWrapper(wrappedParameter, false);
 
-         if (!opMetaData.isOneWayOperation())
+         if (!opMetaData.isOneWay())
          {
             xmlName = new QName(targetNS, operationName + "Response");
             xmlType = new QName(targetNS, operationName + "Response");
@@ -461,7 +461,7 @@
       String returnTypeName = returnType.getName();
       if ((returnType == void.class) == false)
       {
-         if (opMetaData.isOneWayOperation())
+         if (opMetaData.isOneWay())
             throw new IllegalArgumentException("[JSR-181 2.5.1] The method '" + method.getName() + "' can not have a return value if it is marked OneWay");
 
          xmlType = typeMapping.getXMLType(returnType);
@@ -681,7 +681,7 @@
 
    private void addFault(OperationMetaData omd, TypesMetaData tmd, Class<?> exception)
    {
-      if (omd.isOneWayOperation())
+      if (omd.isOneWay())
          throw new IllegalStateException("JSR-181 4.3.1 - A JSR-181 processor is REQUIRED to report an error if an operation marked "
                + "@Oneway has a return value, declares any checked exceptions or has any INOUT or OUT parameters.");
 
@@ -714,7 +714,7 @@
       AddressingOpMetaExt addrExt = new AddressingOpMetaExt(ADDR.getNamespaceURI());
       addrExt.setInboundAction(tns + "/" + portTypeName + "/IN");
 
-      if (!opMetaData.isOneWayOperation())
+      if (!opMetaData.isOneWay())
          addrExt.setOutboundAction(tns + "/" + portTypeName + "/OUT");
 
       opMetaData.addExtension(addrExt);

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -41,15 +41,11 @@
 import javax.xml.rpc.ServiceException;
 import javax.xml.rpc.Stub;
 import javax.xml.rpc.encoding.SerializerFactory;
+import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.SOAPException;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.http.HTTPException;
-import javax.xml.ws.soap.SOAPBinding;
-import javax.xml.ws.soap.SOAPFaultException;
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.Constants;
-import org.jboss.ws.WSException;
 import org.jboss.ws.binding.UnboundHeader;
 import org.jboss.ws.common.CommonClient;
 import org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl;
@@ -319,7 +315,14 @@
     */
    public void invokeOneWay(Object[] inputParams)
    {
-      invokeInternal(operationName, inputParams, unboundHeaders, true);
+      try
+      {
+         invokeInternal(operationName, inputParams, unboundHeaders, true);
+      }
+      catch (RemoteException ex)
+      {
+         throw new JAXRPCException(ex);
+      }
    }
 
    /** Invokes a specific operation using a synchronous request-response interaction mode.
@@ -533,7 +536,7 @@
    {
    }
 
-   private Object invokeInternal(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway)
+   private Object invokeInternal(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean forceOneway) throws RemoteException
    {
       if (opName.equals(operationName) == false)
          setOperationName(opName);
@@ -549,43 +552,28 @@
       Object retObj = null;
       try
       {
-         retObj = super.invoke(opName, inputParams, unboundHeaders, properties, oneway);
+         retObj = super.invoke(opName, inputParams, unboundHeaders, properties, forceOneway);
          return retObj;
       }
-      catch (RemoteException ex)
+      catch (SOAPFaultException ex)
       {
-         handleRemoteException(opMetaData, ex);
-         return retObj;
+         log.error("Call invocation failed", ex);
+         String faultCode = ex.getFaultCode().getLocalPart();
+         throw new RemoteException("Call invocation failed with code [" + faultCode + "] because of: " + ex.getFaultString(), ex);
       }
-      finally
+      catch (RemoteException rex)
       {
-         // Reset the message context association
-         MessageContextAssociation.popMessageContext();
+         throw rex;
       }
-   }
-
-   /**
-    * 4.13  Conformance (Remote Exceptions): If an error occurs during a remote operation invocation, an implemention 
-    * MUST throw a service specific exception if possible. If the error cannot be mapped to a service
-    * specific exception, an implementation MUST throw a ProtocolException or one of its subclasses, as
-    * appropriate for the binding in use. See section 6.4.1 for more details.
-    */
-   private void handleRemoteException(OperationMetaData opMetaData, RemoteException ex)
-   {
-      String bindingId = opMetaData.getEndpointMetaData().getBindingId();
-      if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) || SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+      catch (Exception ex)
       {
-         throw new SOAPFaultException(null);
+         throw new RemoteException("Call invocation failed", ex);
       }
-      else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+      finally
       {
-         // FIXME: provide actual status code
-         throw new HTTPException(-1);
+         // Reset the message context association
+         MessageContextAssociation.popMessageContext();
       }
-      else
-      {
-         throw new WSException("Unsuported binding: " + bindingId);
-      }
    }
 
    @Override

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallProxy.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -139,7 +139,7 @@
 
          try
          {
-            if (opMetaData.isOneWayOperation())
+            if (opMetaData.isOneWay())
             {
                call.invokeOneWay(args);
                return null;

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -30,10 +30,16 @@
 import javax.xml.namespace.QName;
 import javax.xml.ws.Binding;
 import javax.xml.ws.BindingProvider;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.http.HTTPBinding;
+import javax.xml.ws.http.HTTPException;
+import javax.xml.ws.soap.SOAPBinding;
+import javax.xml.ws.soap.SOAPFaultException;
 
+import org.jboss.logging.Logger;
 import org.jboss.ws.common.CommonBindingProvider;
 import org.jboss.ws.common.CommonClient;
 import org.jboss.ws.common.CommonMessageContext;
@@ -44,6 +50,7 @@
 import org.jboss.ws.jaxws.handler.PortInfoImpl;
 import org.jboss.ws.jaxws.handler.SOAPMessageContextJAXWS;
 import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
 import org.jboss.ws.soap.MessageContextAssociation;
 
@@ -55,6 +62,9 @@
  */
 public class ClientImpl extends CommonClient implements BindingProvider
 {
+   // provide logging
+   private static Logger log = Logger.getLogger(ClientImpl.class);
+   
    public ClientImpl(EndpointMetaData epMetaData, HandlerResolver handlerResolver)
    {
       super(epMetaData);
@@ -129,6 +139,19 @@
          Object retObj = invoke(opName, args, null, resContext, false);
          return retObj;
       }
+      catch (Exception ex)
+      {
+         OperationMetaData opMetaData = getOperationMetaData();
+         if (opMetaData.isOneWay())
+         {
+            handleOneWayException(opMetaData, ex);
+         }
+         else
+         {
+            handleRemoteException(opMetaData, ex);
+         }
+         return null;
+      }
       finally
       {
          // Reset the message context association
@@ -136,6 +159,46 @@
       }
    }
 
+   /**
+    * 6.7 Conformance (One-way operations): When sending a one-way message, implementations
+    * a WebServiceException if any error is detected when sending the message.
+    */
+   private void handleOneWayException(OperationMetaData opMetaData, Exception ex)
+   {
+      if (ex instanceof WebServiceException)
+      {
+         throw (WebServiceException)ex;
+      }
+      else
+      {
+         throw new WebServiceException(ex);
+      }
+   }
+
+   /**
+    * 4.13  Conformance (Remote Exceptions): If an error occurs during a remote operation invocation, an implemention 
+    * MUST throw a service specific exception if possible. If the error cannot be mapped to a service
+    * specific exception, an implementation MUST throw a ProtocolException or one of its subclasses, as
+    * appropriate for the binding in use. See section 6.4.1 for more details.
+    */
+   private void handleRemoteException(OperationMetaData opMetaData, Exception ex)
+   {
+      String bindingId = opMetaData.getEndpointMetaData().getBindingId();
+      if (SOAPBinding.SOAP11HTTP_BINDING.equals(bindingId) || SOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
+      {
+         throw new SOAPFaultException(null);
+      }
+      else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+      {
+         // FIXME: provide actual status code
+         throw new HTTPException(-1);
+      }
+      else
+      {
+         throw new WebServiceException("Unsuported binding: " + bindingId);
+      }
+   }
+
    @Override
    public void setTargetEndpointAddress(String endpointAddress)
    {

Deleted: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -1,248 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ws.jaxws.client;
-
-// $Id$
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.rmi.RemoteException;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Future;
-
-import javax.xml.namespace.QName;
-import javax.xml.ws.AsyncHandler;
-import javax.xml.ws.BindingProvider;
-import javax.xml.ws.Response;
-import javax.xml.ws.WebServiceException;
-
-import org.jboss.logging.Logger;
-import org.jboss.ws.WSException;
-import org.jboss.ws.metadata.EndpointMetaData;
-import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.utils.JavaUtils;
-
-/**
- * The dynamic proxy that delegates to the underlying client implementation
- *
- * @author Thomas.Diesler at jboss.org
- * @since 04-Jul-2006
- */
-public class ClientProxy implements InvocationHandler
-{
-   // provide logging
-   private static final Logger log = Logger.getLogger(ClientProxy.class);
-
-   // The underlying Call
-   private ClientImpl client;
-   // List<Method> of the Stub methods
-   private List stubMethods;
-   // List<Method> of the Object methods
-   private List objectMethods;
-   // The service configured executor
-   private ExecutorService executor;
-
-   // The set of standard properties
-   private static final Set<String> standardProperties = new HashSet<String>();
-   static
-   {
-      standardProperties.add(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
-      standardProperties.add(BindingProvider.SESSION_MAINTAIN_PROPERTY);
-      standardProperties.add(BindingProvider.USERNAME_PROPERTY);
-      standardProperties.add(BindingProvider.PASSWORD_PROPERTY);
-      standardProperties.add(BindingProvider.SOAPACTION_USE_PROPERTY);
-      standardProperties.add(BindingProvider.SOAPACTION_URI_PROPERTY);
-   }
-
-   public ClientProxy(ExecutorService executor, ClientImpl client)
-   {
-      this.client = client;
-      this.executor = executor;
-      this.stubMethods = Arrays.asList(BindingProvider.class.getMethods());
-      this.objectMethods = Arrays.asList(Object.class.getMethods());
-   }
-
-   /** Processes a method invocation on a proxy instance and returns the result.
-    */
-   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
-   {
-      // An invocation on the Stub interface
-      String methodName = method.getName();
-      if (stubMethods.contains(method))
-      {
-         Method stubMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
-         return stubMethod.invoke(client, args);
-      }
-
-      // An invocation on proxy's Object class
-      else if (objectMethods.contains(method))
-      {
-         Method objMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
-         return objMethod.invoke(client, args);
-      }
-
-      // An invocation on the service endpoint interface
-      else
-      {
-         EndpointMetaData epMetaData = client.getEndpointMetaData();
-         OperationMetaData opMetaData = epMetaData.getOperation(method);
-         if (opMetaData == null)
-            throw new WSException("Cannot obtain operation meta data for: " + methodName);
-
-         QName opName = opMetaData.getQName();
-
-         if (log.isTraceEnabled())
-            log.trace("Invoke method: " + method + opMetaData);
-
-         try
-         {
-            Object retObj;
-            Class retType = method.getReturnType();
-            boolean isAsync = methodName.endsWith("Async");
-
-            // Invoke asynchronously
-            if (isAsync && JavaUtils.isAssignableFrom(Response.class, retType))
-            {
-               retObj = invokeAsync(opName, args, retType);
-            }
-            // Invoke asynchronously with handler
-            else if (isAsync && JavaUtils.isAssignableFrom(Future.class, retType) && args.length > 1)
-            {
-               Object handler = args[args.length - 1];
-               retObj = invokeAsync(opName, args, retType, (AsyncHandler)handler);
-            }
-            // Invoke synchronously
-            else
-            {
-               Map<String, Object> resContext = client.getBindingProvider().getResponseContext();
-               retObj = invoke(opName, args, retType, resContext);
-            }
-            return retObj;
-         }
-         catch (Exception ex)
-         {
-            handleException(ex);
-            return null;
-         }
-      }
-   }
-
-   private Object invoke(QName opName, Object[] args, Class retType, Map<String, Object> resContext) throws RemoteException
-   {
-      Object retObj = client.invoke(opName, args, resContext);
-      if (retObj != null)
-      {
-         if (retType == null)
-            throw new WSException("Return value not supported by: " + opName);
-
-         if (JavaUtils.isPrimitive(retType))
-            retObj = JavaUtils.getPrimitiveValue(retObj);
-      }
-      return retObj;
-   }
-
-   private Response invokeAsync(QName opName, Object[] args, Class retType)
-   {
-      ResponseImpl response = new ResponseImpl();
-      Runnable task = new AsyncRunnable(response, null, opName, args, retType);
-      Future future = executor.submit(task);
-      response.setFuture(future);
-      return response;
-   }
-
-   private Future invokeAsync(QName opName, Object[] args, Class retType, AsyncHandler handler)
-   {
-      ResponseImpl response = new ResponseImpl();
-      Runnable task = new AsyncRunnable(response, handler, opName, args, retType);
-      Future future = executor.submit(task);
-      response.setFuture(future);
-      return response;
-   }
-
-   private void handleException(Exception ex) throws Throwable
-   {
-      Throwable th = ex;
-      throw th;
-   }
-
-   class AsyncRunnable implements Runnable
-   {
-      private ResponseImpl response;
-      private AsyncHandler handler;
-      private QName opName;
-      private Object[] args;
-      private Class retType;
-
-      public AsyncRunnable(ResponseImpl response, AsyncHandler handler, QName opName, Object[] args, Class retType)
-      {
-         this.response = response;
-         this.handler = handler;
-         this.opName = opName;
-         this.args = args;
-         this.retType = retType;
-      }
-
-      public void run()
-      {
-         try
-         {
-            Map<String, Object> resContext = response.getContext();
-            Object result = invoke(opName, args, retType, resContext);
-            response.set(result);
-
-            // Call the handler if available
-            if (handler != null)
-               handler.handleResponse(response);
-         }
-         catch (Exception ex)
-         {
-            handleAsynInvokeException(ex);
-         }
-      }
-
-      // 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync
-      // method, an implementation MUST throw a WebServiceException if there is any error in the configuration 
-      // of the Dispatch instance. Errors that occur during the invocation are reported when the client
-      // attempts to retrieve the results of the operation.
-      private void handleAsynInvokeException(Exception ex)
-      {
-         String msg = "Cannot dispatch message";
-         log.error(msg, ex);
-
-         WebServiceException wsex;
-         if (ex instanceof WebServiceException)
-         {
-            wsex = (WebServiceException)ex;
-         }
-         else
-         {
-            wsex = new WebServiceException(msg, ex);
-         }
-         response.setException(wsex);
-      }
-   }
-}

Added: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -0,0 +1,248 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ws.jaxws.client;
+
+// $Id$
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.rmi.RemoteException;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+
+import javax.xml.namespace.QName;
+import javax.xml.ws.AsyncHandler;
+import javax.xml.ws.BindingProvider;
+import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.WSException;
+import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.utils.JavaUtils;
+
+/**
+ * The dynamic proxy that delegates to the underlying client implementation
+ *
+ * @author Thomas.Diesler at jboss.org
+ * @since 04-Jul-2006
+ */
+public class ClientProxy implements InvocationHandler
+{
+   // provide logging
+   private static final Logger log = Logger.getLogger(ClientProxy.class);
+
+   // The underlying Call
+   private ClientImpl client;
+   // List<Method> of the Stub methods
+   private List stubMethods;
+   // List<Method> of the Object methods
+   private List objectMethods;
+   // The service configured executor
+   private ExecutorService executor;
+
+   // The set of standard properties
+   private static final Set<String> standardProperties = new HashSet<String>();
+   static
+   {
+      standardProperties.add(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
+      standardProperties.add(BindingProvider.SESSION_MAINTAIN_PROPERTY);
+      standardProperties.add(BindingProvider.USERNAME_PROPERTY);
+      standardProperties.add(BindingProvider.PASSWORD_PROPERTY);
+      standardProperties.add(BindingProvider.SOAPACTION_USE_PROPERTY);
+      standardProperties.add(BindingProvider.SOAPACTION_URI_PROPERTY);
+   }
+
+   public ClientProxy(ExecutorService executor, ClientImpl client)
+   {
+      this.client = client;
+      this.executor = executor;
+      this.stubMethods = Arrays.asList(BindingProvider.class.getMethods());
+      this.objectMethods = Arrays.asList(Object.class.getMethods());
+   }
+
+   /** Processes a method invocation on a proxy instance and returns the result.
+    */
+   public Object invoke(Object proxy, Method method, Object[] args) throws Throwable
+   {
+      // An invocation on the Stub interface
+      String methodName = method.getName();
+      if (stubMethods.contains(method))
+      {
+         Method stubMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
+         return stubMethod.invoke(client, args);
+      }
+
+      // An invocation on proxy's Object class
+      else if (objectMethods.contains(method))
+      {
+         Method objMethod = ClientImpl.class.getMethod(methodName, method.getParameterTypes());
+         return objMethod.invoke(client, args);
+      }
+
+      // An invocation on the service endpoint interface
+      else
+      {
+         EndpointMetaData epMetaData = client.getEndpointMetaData();
+         OperationMetaData opMetaData = epMetaData.getOperation(method);
+         if (opMetaData == null)
+            throw new WSException("Cannot obtain operation meta data for: " + methodName);
+
+         QName opName = opMetaData.getQName();
+
+         if (log.isTraceEnabled())
+            log.trace("Invoke method: " + method + opMetaData);
+
+         try
+         {
+            Object retObj;
+            Class retType = method.getReturnType();
+            boolean isAsync = methodName.endsWith("Async");
+
+            // Invoke asynchronously
+            if (isAsync && JavaUtils.isAssignableFrom(Response.class, retType))
+            {
+               retObj = invokeAsync(opName, args, retType);
+            }
+            // Invoke asynchronously with handler
+            else if (isAsync && JavaUtils.isAssignableFrom(Future.class, retType) && args.length > 1)
+            {
+               Object handler = args[args.length - 1];
+               retObj = invokeAsync(opName, args, retType, (AsyncHandler)handler);
+            }
+            // Invoke synchronously
+            else
+            {
+               Map<String, Object> resContext = client.getBindingProvider().getResponseContext();
+               retObj = invoke(opName, args, retType, resContext);
+            }
+            return retObj;
+         }
+         catch (Exception ex)
+         {
+            handleException(ex);
+            return null;
+         }
+      }
+   }
+
+   private Object invoke(QName opName, Object[] args, Class retType, Map<String, Object> resContext) throws RemoteException
+   {
+      Object retObj = client.invoke(opName, args, resContext);
+      if (retObj != null)
+      {
+         if (retType == null)
+            throw new WSException("Return value not supported by: " + opName);
+
+         if (JavaUtils.isPrimitive(retType))
+            retObj = JavaUtils.getPrimitiveValue(retObj);
+      }
+      return retObj;
+   }
+
+   private Response invokeAsync(QName opName, Object[] args, Class retType)
+   {
+      ResponseImpl response = new ResponseImpl();
+      Runnable task = new AsyncRunnable(response, null, opName, args, retType);
+      Future future = executor.submit(task);
+      response.setFuture(future);
+      return response;
+   }
+
+   private Future invokeAsync(QName opName, Object[] args, Class retType, AsyncHandler handler)
+   {
+      ResponseImpl response = new ResponseImpl();
+      Runnable task = new AsyncRunnable(response, handler, opName, args, retType);
+      Future future = executor.submit(task);
+      response.setFuture(future);
+      return response;
+   }
+
+   private void handleException(Exception ex) throws Throwable
+   {
+      Throwable th = ex;
+      throw th;
+   }
+
+   class AsyncRunnable implements Runnable
+   {
+      private ResponseImpl response;
+      private AsyncHandler handler;
+      private QName opName;
+      private Object[] args;
+      private Class retType;
+
+      public AsyncRunnable(ResponseImpl response, AsyncHandler handler, QName opName, Object[] args, Class retType)
+      {
+         this.response = response;
+         this.handler = handler;
+         this.opName = opName;
+         this.args = args;
+         this.retType = retType;
+      }
+
+      public void run()
+      {
+         try
+         {
+            Map<String, Object> resContext = response.getContext();
+            Object result = invoke(opName, args, retType, resContext);
+            response.set(result);
+
+            // Call the handler if available
+            if (handler != null)
+               handler.handleResponse(response);
+         }
+         catch (Exception ex)
+         {
+            handleAsynInvokeException(ex);
+         }
+      }
+
+      // 4.18 Conformance (Failed Dispatch.invokeAsync): When an operation is invoked using an invokeAsync
+      // method, an implementation MUST throw a WebServiceException if there is any error in the configuration 
+      // of the Dispatch instance. Errors that occur during the invocation are reported when the client
+      // attempts to retrieve the results of the operation.
+      private void handleAsynInvokeException(Exception ex)
+      {
+         String msg = "Cannot dispatch message";
+         log.error(msg, ex);
+
+         WebServiceException wsex;
+         if (ex instanceof WebServiceException)
+         {
+            wsex = (WebServiceException)ex;
+         }
+         else
+         {
+            wsex = new WebServiceException(msg, ex);
+         }
+         response.setException(wsex);
+      }
+   }
+}

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/spi/ProviderImpl.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -30,10 +30,6 @@
 import javax.xml.ws.spi.Provider;
 import javax.xml.ws.spi.ServiceDelegate;
 
-import org.jboss.ws.annotation.PortComponent;
-import org.jboss.ws.server.HttpContext;
-import org.jboss.ws.server.HttpServer;
-
 /**
  * Service provider for ServiceDelegate and Endpoint objects.
  *  

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/metadata/OperationMetaData.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -362,7 +362,7 @@
       return pass;
    }
 
-   public boolean isOneWayOperation()
+   public boolean isOneWay()
    {
       return oneWay;
    }

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/server/AbstractServiceEndpointInvoker.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -149,7 +149,7 @@
             // Get the operation meta data from the SOAP message
             opMetaData = getDispatchDestination(epMetaData, reqMessage);
             msgContext.setOperationMetaData(opMetaData);
-            oneway = opMetaData.isOneWayOperation();
+            oneway = opMetaData.isOneWay();
 
             // Unbind the request message
             epInv = binding.unbindRequestMessage(opMetaData, reqMessage);

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/helpers/JavaToWSDLHelper.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -211,7 +211,7 @@
       else
          wsdlInterfaceOperation.setStyle(Constants.URI_STYLE_RPC);
 
-      if (op.isOneWayOperation())
+      if (op.isOneWay())
          wsdlInterfaceOperation.setPattern(Constants.WSDL20_PATTERN_IN_ONLY);
       else
          wsdlInterfaceOperation.setPattern(Constants.WSDL20_PATTERN_IN_OUT);
@@ -224,7 +224,7 @@
       {
          if (pmd.getMode() != ParameterMode.IN)
          {
-            if(op.isOneWayOperation())
+            if(op.isOneWay())
                throw new WSException(opname + " is a oneway operation and" +
                " defines a holder");
 

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java	2006-09-25 22:53:34 UTC (rev 1051)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/tools/metadata/ReflectiveMetaDataBuilder.java	2006-09-26 08:49:54 UTC (rev 1052)
@@ -167,7 +167,7 @@
 
             om.addParameter(wrappedParameter);
 
-            if (! om.isOneWayOperation())
+            if (! om.isOneWay())
             {
                xmlType = xmlName = new QName(tmd.typeNamespace, om.getResponseName().getLocalPart());
                ParameterMetaData retMetaData = new ParameterMetaData(om, xmlName, xmlType, null);
@@ -225,7 +225,7 @@
          if (om.isDocumentWrapped())
          {
             ParameterWrapping.generateWrapper(wrappedParameter, false);
-            if (! om.isOneWayOperation())
+            if (! om.isOneWay())
                ParameterWrapping.generateWrapper(om.getReturnParameter(), false);
          }
 




More information about the jboss-svn-commits mailing list