[jboss-svn-commits] JBossWS SVN: r1023 - in branches/tdiesler/trunk/src: main/java/javax/xml/ws main/java/org/jboss/ws/common main/java/org/jboss/ws/deployment main/java/org/jboss/ws/jaxrpc main/java/org/jboss/ws/jaxws main/java/org/jboss/ws/jaxws/client main/java/org/jboss/ws/jaxws/core main/java/org/jboss/ws/jaxws/handler test/java/org/jboss/test/ws/common/binding test/java/org/jboss/test/ws/common/soap/attachment

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Wed Sep 20 09:14:21 EDT 2006


Author: thomas.diesler at jboss.com
Date: 2006-09-20 09:13:49 -0400 (Wed, 20 Sep 2006)
New Revision: 1023

Added:
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java
Modified:
   branches/tdiesler/trunk/src/main/java/javax/xml/ws/BindingProvider.java
   branches/tdiesler/trunk/src/main/java/javax/xml/ws/Service.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonBindingProvider.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP11Binding.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP12Binding.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java
   branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
   branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
Log:
partial commit

Modified: branches/tdiesler/trunk/src/main/java/javax/xml/ws/BindingProvider.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/javax/xml/ws/BindingProvider.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/javax/xml/ws/BindingProvider.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -24,19 +24,33 @@
 import java.util.Map;
 
 /**
- * The BindingProvider interface provides access to the protocol binding and 
+ * The BindingProvider interface provides access to the protocol binding and
  * associated context objects for request and response message processing.
- *  
+ * 
  * @author Thomas.Diesler at jboss.com
  * @since 03-May-2006
  */
 public interface BindingProvider
 {
+   // REQUIRED: The address of the service endpoint as a protocol specific URI. The URI scheme must match the protocol binding in use.
+   public static final String ENDPOINT_ADDRESS_PROPERTY = "javax.xml.ws.service.endpoint.address";
+
+   // REQUIRED: Username for HTTP basic authentication.
    public static final String USERNAME_PROPERTY = "javax.xml.ws.security.auth.username";
+
+   // REQUIRED: Password for HTTP basic password authentication.
    public static final String PASSWORD_PROPERTY = "javax.xml.ws.security.auth.password";
-   public static final String ENDPOINT_ADDRESS_PROPERTY = "javax.xml.ws.service.endpoint.address";
+
+   // REQUIRED: Used by a client to indicate whether it is prepared to participate in a service endpoint initiated session. 
+   // Default value is false.
    public static final String SESSION_MAINTAIN_PROPERTY = "javax.xml.ws.session.maintain";
+
+   // OPTIONAL: Controls whether the SOAPAction HTTP header is used in SOAP/HTTP requests. 
+   // Default value is false.
    public static final String SOAPACTION_USE_PROPERTY = "javax.xml.ws.soap.http.soapaction.use";
+
+   // OPTIONAL: The value of the SOAPAction HTTP uri header if the use property is set to true. 
+   // Default value is an empty string.
    public static final String SOAPACTION_URI_PROPERTY = "javax.xml.ws.soap.http.soapaction.uri";
 
    Map<String, Object> getRequestContext();

Modified: branches/tdiesler/trunk/src/main/java/javax/xml/ws/Service.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/javax/xml/ws/Service.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/javax/xml/ws/Service.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -24,7 +24,6 @@
 import java.net.URL;
 import java.util.Iterator;
 import java.util.concurrent.Executor;
-import java.util.concurrent.ExecutorService;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.namespace.QName;
@@ -32,9 +31,6 @@
 import javax.xml.ws.spi.Provider;
 import javax.xml.ws.spi.ServiceDelegate;
 
-import org.jboss.ws.jaxws.client.DispatchImpl;
-import org.jboss.ws.metadata.EndpointMetaData;
-
 /**
  * Service objects provide the client view of a Web service.
  * 
@@ -73,12 +69,30 @@
 
    public Object getPort(QName portName, Class serviceEndpointInterface)
    {
-      return delegate.getPort(portName, serviceEndpointInterface);
+      Object port = null;
+      try
+      {
+         port = delegate.getPort(portName, serviceEndpointInterface);
+      }
+      catch (Exception ex)
+      {
+         handleServiceGetPortFailure(ex);
+      }
+      return port;
    }
 
    public Object getPort(Class serviceEndpointInterface)
    {
-      return delegate.getPort(serviceEndpointInterface);
+      Object port = null;
+      try
+      {
+         port = delegate.getPort(serviceEndpointInterface);
+      }
+      catch (Exception ex)
+      {
+         handleServiceGetPortFailure(ex);
+      }
+      return port;
    }
 
    public void addPort(QName portName, String bindingId, String endpointAddress)
@@ -165,6 +179,18 @@
       return service;
    }
 
+   // 4.12 Conformance (Service.getPort failure): If creation of a proxy fails, an implementation MUST throw
+   // javax.xml.ws.WebServiceException. The cause of that exception SHOULD be set to an exception
+   // that provides more information on the cause of the error (e.g. an IOException).
+   private static void handleServiceGetPortFailure(Exception ex)
+   {
+      if (ex instanceof WebServiceException)
+      {
+         throw (WebServiceException)ex;
+      }
+      throw new WebServiceException(ex);
+   }
+
    // 4.2 Conformance (Service Creation Failure): If a create method fails to create a service object, it MUST
    // throw WebServiceException. The cause of that exception SHOULD be set to an exception that provides
    // more information on the cause of the error (e.g. an IOException).

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonBindingProvider.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonBindingProvider.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonBindingProvider.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -24,7 +24,12 @@
 // $Id$
 
 import org.jboss.ws.WSException;
+import org.jboss.ws.jaxrpc.SOAP11BindingJAXRPC;
+import org.jboss.ws.jaxrpc.SOAP12BindingJAXRPC;
+import org.jboss.ws.jaxws.core.SOAP11BindingJAXWS;
+import org.jboss.ws.jaxws.core.SOAP12BindingJAXWS;
 import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
 
 /**
  * Provides access to the protocol binding.
@@ -40,23 +45,23 @@
    public CommonBindingProvider(EndpointMetaData epMetaData)
    {
       this.epMetaData = epMetaData;
-      initBinding(epMetaData.getBindingId());
+      initBinding(epMetaData.getBindingId(), epMetaData.getType());
    }
    
-   public CommonBindingProvider(String bindingId)
+   public CommonBindingProvider(String bindingId, Type type)
    {
-      initBinding(bindingId);
+      initBinding(bindingId, type);
    }
 
-   protected void initBinding(String bindingId)
+   protected void initBinding(String bindingId, Type type)
    {
       if (CommonSOAPBinding.SOAP11HTTP_BINDING.equals(bindingId))
       {
-         binding = new CommonSOAP11Binding();
+         binding = (type == Type.JAXWS ? new SOAP11BindingJAXWS() : new SOAP11BindingJAXRPC());
       }
       else if (CommonSOAPBinding.SOAP12HTTP_BINDING.equals(bindingId))
       {
-         binding = new CommonSOAP12Binding();
+         binding = (type == Type.JAXWS ? new SOAP12BindingJAXWS() : new SOAP12BindingJAXRPC());
       }
       else
       {

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-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonClient.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -213,7 +213,7 @@
     * 6) unwrap the result using the BindingProvider
     * 7) return the result
     */
-   protected Object invoke(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway) throws RemoteException
+   protected Object invoke(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, Map<String, Object> resContext, boolean oneway) throws RemoteException
    {
       if (opName.equals(operationName) == false)
          setOperationName(opName);
@@ -340,7 +340,7 @@
       }
       finally
       {
-         getResponseContext().putAll(msgContext.getProperties());
+         resContext.putAll(msgContext.getProperties());
       }
    }
 
@@ -355,8 +355,6 @@
 
    protected abstract Map<String, Object> getRequestContext();
 
-   protected abstract Map<String, Object> getResponseContext();
-
    /** Synchronize the operation paramters with the call output parameters.
     */
    private Object syncOutputParams(Object[] inParams, EndpointInvocation epInv) throws SOAPException

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP11Binding.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP11Binding.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP11Binding.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -23,22 +23,13 @@
 
 // $Id$
 
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPEnvelope;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 
 import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
 import org.jboss.ws.jaxrpc.Use;
 import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 
 /**
@@ -47,8 +38,12 @@
  * @author Thomas.Diesler at jboss.com
  * @since 04-Jul-2006
  */
-public class CommonSOAP11Binding extends CommonSOAPBinding
+public abstract class CommonSOAP11Binding extends CommonSOAPBinding
 {
+   public CommonSOAP11Binding()
+   {
+   }
+
    /** Create the SOAP-1.1 message */
    protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
    {

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP12Binding.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP12Binding.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAP12Binding.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -23,20 +23,11 @@
 
 // $Id$
 
-import java.util.Map;
-
-import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPMessage;
 
 import org.jboss.ws.Constants;
-import org.jboss.ws.binding.BindingException;
-import org.jboss.ws.binding.EndpointInvocation;
-import org.jboss.ws.binding.UnboundHeader;
 import org.jboss.ws.metadata.OperationMetaData;
-import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 
 /**
@@ -45,8 +36,13 @@
  * @author Thomas.Diesler at jboss.com
  * @since 04-Jul-2006
  */
-public class CommonSOAP12Binding extends CommonSOAPBinding
+public abstract class CommonSOAP12Binding extends CommonSOAPBinding
 {
+   
+   public CommonSOAP12Binding()
+   {
+   }
+
    /** Create the SOAP-1.1 message */
    protected SOAPMessage createMessage(OperationMetaData opMetaData) throws SOAPException
    {

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-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/common/CommonSOAPBinding.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -30,13 +30,10 @@
 
 import javax.activation.DataHandler;
 import javax.xml.namespace.QName;
-import javax.xml.rpc.Call;
-import javax.xml.rpc.JAXRPCException;
 import javax.xml.rpc.ParameterMode;
 import javax.xml.rpc.soap.SOAPFaultException;
 import javax.xml.soap.AttachmentPart;
 import javax.xml.soap.MessageFactory;
-import javax.xml.soap.MimeHeaders;
 import javax.xml.soap.Name;
 import javax.xml.soap.SOAPBody;
 import javax.xml.soap.SOAPBodyElement;
@@ -99,6 +96,10 @@
    /** A constant representing the identity of the SOAP 1.1 over HTTP binding. */
    public static final String SOAP11HTTP_BINDING = "http://schemas.xmlsoap.org/wsdl/soap/http";
 
+   public CommonSOAPBinding()
+   {
+   }
+
    public MessageFactory getMessageFactory()
    {
       return new MessageFactoryImpl();
@@ -223,27 +224,8 @@
          }
 
          // Set the SOAPAction 
-         MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
-         String soapAction = opMetaData.getSOAPAction();
+         setSOAPActionHeader(opMetaData, reqMessage);
 
-         // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
-         // with a quoted value equal to the value of the soapAction attribute of
-         // soapbind:operation, if present in the corresponding WSDL description.
-
-         // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
-         // with a quoted empty string value, if in the corresponding WSDL description,
-         // the soapAction attribute of soapbind:operation is either not present, or
-         // present with an empty string as its value.
-
-         if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
-            log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
-
-         String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
-         if (soapActionProperty != null)
-            soapAction = soapActionProperty;
-
-         mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
-
          return reqMessage;
       }
       catch (Exception e)
@@ -253,6 +235,9 @@
       }
    }
 
+   /** Override to set the SOAPAction header */
+   public abstract void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage);
+
    /** On the server side, extract the IN parameters from the payload and populate an Invocation object */
    public EndpointInvocation unbindRequestMessage(OperationMetaData opMetaData, Object payload) throws BindingException
    {
@@ -878,7 +863,7 @@
       }
 
       if (soapContentElement == null && optional == false)
-         throw new JAXRPCException("Cannot find child element: " + xmlName);
+         throw new WSException("Cannot find child element: " + xmlName);
 
       if (paramMetaData.isXOP())
       {

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/deployment/JAXWSProviderMetaDataBuilderJSE.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -29,7 +29,9 @@
 import javax.xml.namespace.QName;
 import javax.xml.soap.SOAPMessage;
 import javax.xml.transform.Source;
+import javax.xml.ws.Provider;
 import javax.xml.ws.ServiceMode;
+import javax.xml.ws.WebServiceException;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.Service.Mode;
 
@@ -45,6 +47,7 @@
 import org.jboss.ws.metadata.EndpointMetaData.Type;
 import org.jboss.ws.metadata.j2ee.UnifiedWebMetaData;
 import org.jboss.ws.metadata.wsdl.WSDLUtils;
+import org.jboss.ws.utils.JavaUtils;
 
 /**
  * A server side meta data builder that is based on JSR-181 annotations
@@ -108,16 +111,20 @@
    private ServerEndpointMetaData setupEndpointFromAnnotations(UnifiedMetaData wsMetaData, UnifiedDeploymentInfo udi, Class sepClass, String linkName)
          throws ClassNotFoundException, SecurityException, NoSuchMethodException
    {
+      // 5.3 Conformance (Provider implementation): A Provider based service endpoint implementation MUST
+      // implement a typed Provider interface.
+      if (JavaUtils.isAssignableFrom(Provider.class, sepClass))
+         throw new WebServiceException("Endpoint implementation dos not implement javax.xml.ws.Provider: " + sepClass.getName());
+      
+      // 5.4 Conformance (WebServiceProvider annotation): A Provider based service endpoint implementation
+      // MUST carry a WebServiceProvider annotation
       WebServiceProvider anWebServiceProvider = (WebServiceProvider)sepClass.getAnnotation(WebServiceProvider.class);
       if (anWebServiceProvider == null)
-         throw new WSException("Cannot obtain @WebServiceProvider annotaion from: " + sepClass.getName());
+         throw new WebServiceException("Cannot obtain @WebServiceProvider annotaion from: " + sepClass.getName());
 
-      Class seiClass = null;
-      Class wsClass = (seiClass != null ? seiClass : sepClass);
-
       WSDLUtils wsdlUtils = WSDLUtils.getInstance();
 
-      String name = wsdlUtils.getJustClassName(wsClass);
+      String name = wsdlUtils.getJustClassName(sepClass);
       
       String serviceName = anWebServiceProvider.serviceName();
       if (serviceName.length() == 0)
@@ -125,7 +132,7 @@
 
       String targetNS = anWebServiceProvider.targetNamespace();
       if (targetNS.length() == 0)
-         targetNS = wsdlUtils.getTypeNamespace(wsClass);
+         targetNS = wsdlUtils.getTypeNamespace(sepClass);
 
       String portName = anWebServiceProvider.portName();
       if (portName.length() == 0)
@@ -143,7 +150,7 @@
       sepMetaData.setParameterStyle(ParameterStyle.BARE);
 
       sepMetaData.setServiceEndpointImplName(sepClass.getName());
-      sepMetaData.setServiceEndpointInterfaceName(wsClass.getName());
+      sepMetaData.setServiceEndpointInterfaceName(sepClass.getName());
 
       ServiceMode anServiceMode = (ServiceMode)sepClass.getAnnotation(ServiceMode.class);
       if (anServiceMode != null)
@@ -162,7 +169,7 @@
       // processOrGenerateWSDL(wsClass, serviceMetaData, wsdlLocation, sepMetaData);
 
       // Set the endpoint address
-      processPortComponent(udi, wsClass, linkName, sepMetaData);
+      processPortComponent(udi, sepClass, linkName, sepMetaData);
 
       // init service endpoint id
       ObjectName sepID = getServiceEndpointID(udi, sepMetaData);

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-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/CallImpl.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -42,9 +42,14 @@
 import javax.xml.rpc.Stub;
 import javax.xml.rpc.encoding.SerializerFactory;
 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;
@@ -144,12 +149,6 @@
       return properties;
    }
 
-   @Override
-   protected Map<String, Object> getResponseContext()
-   {
-      return properties;
-   }
-
    /**
     * Add a header that is not bound to an input parameter.
     * A propriatory extension, that is not part of JAXRPC.
@@ -320,14 +319,7 @@
     */
    public void invokeOneWay(Object[] inputParams)
    {
-      try
-      {
-         invokeInternal(operationName, inputParams, unboundHeaders, true);
-      }
-      catch (RemoteException rex)
-      {
-         throw new JAXRPCException("Cannot invokeOneWay", rex.getCause());
-      }
+      invokeInternal(operationName, inputParams, unboundHeaders, true);
    }
 
    /** Invokes a specific operation using a synchronous request-response interaction mode.
@@ -540,8 +532,8 @@
    protected void setOutboundContextProperties()
    {
    }
-   
-   private Object invokeInternal(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway) throws RemoteException
+
+   private Object invokeInternal(QName opName, Object[] inputParams, Map<QName, UnboundHeader> unboundHeaders, boolean oneway)
    {
       if (opName.equals(operationName) == false)
          setOperationName(opName);
@@ -554,11 +546,17 @@
       // Associate a message context with the current thread
       SOAPMessageContextJAXRPC msgContext = new SOAPMessageContextJAXRPC();
       MessageContextAssociation.pushMessageContext(msgContext);
+      Object retObj = null;
       try
       {
-         Object retObj = super.invoke(opName, inputParams, unboundHeaders, oneway);
+         retObj = super.invoke(opName, inputParams, unboundHeaders, properties, oneway);
          return retObj;
       }
+      catch (RemoteException ex)
+      {
+         handleRemoteException(opMetaData, ex);
+         return retObj;
+      }
       finally
       {
          // Reset the message context association
@@ -566,6 +564,30 @@
       }
    }
 
+   /**
+    * 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))
+      {
+         throw new SOAPFaultException(null);
+      }
+      else if (HTTPBinding.HTTP_BINDING.equals(bindingId))
+      {
+         // FIXME: provide actual status code
+         throw new HTTPException(-1);
+      }
+      else
+      {
+         throw new WSException("Unsuported binding: " + bindingId);
+      }
+   }
+
    @Override
    protected boolean callRequestHandlerChain(QName portName, HandlerType type)
    {

Added: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -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.ws.jaxrpc;
+
+//$Id$
+
+import javax.xml.rpc.Call;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.common.CommonSOAP11Binding;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * The JAXRPC SOAP11Binding  
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Sep-2006
+ */
+public class SOAP11BindingJAXRPC extends CommonSOAP11Binding
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(SOAP11BindingJAXRPC.class);
+
+   public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+      String soapAction = opMetaData.getSOAPAction();
+
+      // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted value equal to the value of the soapAction attribute of
+      // soapbind:operation, if present in the corresponding WSDL description.
+
+      // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted empty string value, if in the corresponding WSDL description,
+      // the soapAction attribute of soapbind:operation is either not present, or
+      // present with an empty string as its value.
+
+      if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
+         log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+      String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
+      if (soapActionProperty != null)
+         soapAction = soapActionProperty;
+
+      mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+   }
+
+}


Property changes on: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP11BindingJAXRPC.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Added: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -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.ws.jaxrpc;
+
+//$Id$
+
+import javax.xml.rpc.Call;
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.CommonMessageContext;
+import org.jboss.ws.common.CommonSOAP12Binding;
+import org.jboss.ws.common.CommonSOAPBinding;
+import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.soap.MessageContextAssociation;
+
+/**
+ * The JAXRPC SOAP12Binding  
+ * 
+ * @author Thomas.Diesler at jboss.com
+ * @since 20-Sep-2006
+ */
+public class SOAP12BindingJAXRPC extends CommonSOAP12Binding
+{
+   // provide logging
+   private static Logger log = Logger.getLogger(SOAP12BindingJAXRPC.class);
+
+   public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+      String soapAction = opMetaData.getSOAPAction();
+
+      // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted value equal to the value of the soapAction attribute of
+      // soapbind:operation, if present in the corresponding WSDL description.
+
+      // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted empty string value, if in the corresponding WSDL description,
+      // the soapAction attribute of soapbind:operation is either not present, or
+      // present with an empty string as its value.
+
+      if (msgContext.getProperty(Call.SOAPACTION_USE_PROPERTY) != null)
+         log.info("Ignore Call.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+      String soapActionProperty = (String)msgContext.getProperty(Call.SOAPACTION_URI_PROPERTY);
+      if (soapActionProperty != null)
+         soapAction = soapActionProperty;
+
+      mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+   }
+}


Property changes on: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxrpc/SOAP12BindingJAXRPC.java
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + LF

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBDeserializer.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -30,6 +30,7 @@
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 import javax.xml.transform.stream.StreamSource;
+import javax.xml.ws.WebServiceException;
 
 import org.jboss.logging.Logger;
 import org.jboss.ws.binding.BindingException;
@@ -53,13 +54,11 @@
    }
 
    @Override
-   public Object deserialize(QName xmlName, QName xmlType, String val, SerializationContext serContext) throws BindingException
+   public Object deserialize(QName xmlName, QName xmlType, String val, SerializationContext serContext) 
    {
       log.debug("deserialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
 
       Object value = null;
-      String typeName = xmlType.getLocalPart();
-
       try
       {
          TypeMappingImpl typeMapping = serContext.getTypeMapping();
@@ -70,19 +69,25 @@
          ByteArrayInputStream ins = new ByteArrayInputStream(val.getBytes("UTF-8"));
          JAXBElement jbe = unmarshaller.unmarshal(new StreamSource(ins), javaType);
          value = jbe.getValue();
+         
+         log.debug("deserialized: " + (value != null ? value.getClass().getName() : null));
       }
-      catch (RuntimeException e)
+      catch (Exception ex)
       {
-         throw e;
+         handleUnmarshallException(ex);
       }
-      catch (Exception e)
-      {
-         throw new BindingException(e);
-      }
-
-
-      log.debug("deserialized: " + (value != null ? value.getClass().getName() : null));
       return value;
 
    }
+
+   // 4.21 Conformance (Marshalling failure): If an error occurs when using the supplied JAXBContext to marshall 
+   // a request or unmarshall a response, an implementation MUST throw a WebServiceException whose
+   // cause is set to the original JAXBException.
+   private void handleUnmarshallException(Exception ex)
+   {
+      if (ex instanceof WebServiceException)
+         throw (WebServiceException)ex;
+      
+      throw new WebServiceException(ex);
+   }
 }

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/JAXBSerializer.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -23,6 +23,14 @@
 
 // $Id$
 
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
+import javax.xml.bind.Marshaller;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceException;
+
 import org.jboss.logging.Logger;
 import org.jboss.ws.binding.BindingException;
 import org.jboss.ws.binding.ComplexTypeSerializer;
@@ -30,12 +38,6 @@
 import org.jboss.ws.jaxrpc.TypeMappingImpl;
 import org.w3c.dom.NamedNodeMap;
 
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBElement;
-import javax.xml.bind.Marshaller;
-import javax.xml.namespace.QName;
-import java.io.StringWriter;
-
 /**
  * A Serializer that can handle complex types by delegating to JAXB.
  *
@@ -56,10 +58,9 @@
    {
       log.debug("serialize: [xmlName=" + xmlName + ",xmlType=" + xmlType + "]");
 
+      String xmlFragment = null;
       try
       {
-         String xmlFragment = null;
-
          TypeMappingImpl typeMapping = serContext.getTypeMapping();
          Class javaType = typeMapping.getJavaType(xmlType);
          JAXBContext jaxbContext = JAXBContext.newInstance(javaType);
@@ -72,16 +73,22 @@
          xmlFragment = strwr.toString();
 
          log.debug("serialized: " + xmlFragment);
-
-         return xmlFragment;
       }
-      catch (RuntimeException rte)
+      catch (Exception ex)
       {
-         throw rte;
+         handleMarshallException(ex);
       }
-      catch (Exception e)
-      {
-         throw new BindingException(e);
-      }
+      return xmlFragment;
    }
+   
+   // 4.21 Conformance (Marshalling failure): If an error occurs when using the supplied JAXBContext to marshall 
+   // a request or unmarshall a response, an implementation MUST throw a WebServiceException whose
+   // cause is set to the original JAXBException.
+   private void handleMarshallException(Exception ex)
+   {
+      if (ex instanceof WebServiceException)
+         throw (WebServiceException)ex;
+      
+      throw new WebServiceException(ex);
+   }
 }

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-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientImpl.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -112,7 +112,7 @@
    }
    
    // Invoked by the proxy invokation handler
-   public Object invoke(QName opName, Object[] args) throws RemoteException
+   public Object invoke(QName opName, Object[] args, Map<String, Object> resContext) throws RemoteException
    {
       // Associate a message context with the current thread
       SOAPMessageContextJAXWS msgContext = new SOAPMessageContextJAXWS();
@@ -126,7 +126,7 @@
 
       try
       {
-         Object retObj = invoke(opName, args, null, false);
+         Object retObj = invoke(opName, args, null, resContext, false);
          return retObj;
       }
       finally

Modified: 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-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ClientProxy.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -29,6 +29,7 @@
 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;
@@ -37,6 +38,7 @@
 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;
@@ -136,7 +138,8 @@
             // Invoke synchronously
             else
             {
-               retObj = invoke(opName, args, retType);
+               Map<String, Object> resContext = client.getBindingProvider().getResponseContext();
+               retObj = invoke(opName, args, retType, resContext);
             }
             return retObj;
          }
@@ -148,9 +151,9 @@
       }
    }
 
-   private Object invoke(QName opName, Object[] args, Class retType) throws RemoteException
+   private Object invoke(QName opName, Object[] args, Class retType, Map<String, Object> resContext) throws RemoteException
    {
-      Object retObj = client.invoke(opName, args);
+      Object retObj = client.invoke(opName, args, resContext);
       if (retObj != null)
       {
          if (retType == null)
@@ -207,17 +210,39 @@
       {
          try
          {
-            Object result = invoke(opName, args, retType);
+            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 (RemoteException ex)
+         catch (Exception ex)
          {
-            log.error("Asynchronous invocation failed", 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/client/DispatchImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/DispatchImpl.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -98,22 +98,27 @@
 
    public Object invoke(Object obj)
    {
-      SOAPMessage reqMsg = getRequestMessage(obj);
+      Object retObj = null;
       try
       {
-         String targetAddress = epMetaData.getEndpointAddress();
-         SOAPMessage resMsg = new SOAPConnectionImpl().call(reqMsg, targetAddress);
-         Object retObj = getReturnObject(resMsg);
-         return retObj;
+         retObj = invokeInternal(obj, getResponseContext());
       }
-      catch (SOAPException ex)
+      catch (Exception ex)
       {
-         String msg = "Cannot dispatch request message";
-         log.error(msg, ex);
-         throw new WebServiceException(msg, ex);
+         handleInvokeException(ex);
       }
+      return retObj;
    }
 
+   private Object invokeInternal(Object obj, Map<String, Object> resContext) throws SOAPException
+   {
+      SOAPMessage reqMsg = getRequestMessage(obj);
+      String targetAddress = epMetaData.getEndpointAddress();
+      SOAPMessage resMsg = new SOAPConnectionImpl().call(reqMsg, targetAddress);
+      Object retObj = getReturnObject(resMsg);
+      return retObj;
+   }
+
    public Response invokeAsync(Object obj)
    {
       ResponseImpl response = new ResponseImpl();
@@ -140,14 +145,31 @@
          String targetAddress = epMetaData.getEndpointAddress();
          new SOAPConnectionImpl().callOneWay(reqMsg, targetAddress);
       }
-      catch (SOAPException ex)
+      catch (Exception ex)
       {
-         String msg = "Cannot dispatch request message one way";
-         log.error(msg, ex);
-         throw new WebServiceException(msg, ex);
+         handleInvokeException(ex);
       }
    }
 
+   // 4.17. Conformance (Failed Dispatch.invoke): When an operation is invoked using an invoke method, an
+   // implementation MUST throw a WebServiceException if there is any error in the configuration of the
+   // Dispatch instance or a ProtocolException if an error occurs during the remote operation invocation.
+   //
+   // 4.19  Conformance (Failed Dispatch.invokeOneWay): When an operation is invoked using an invoke-
+   // OneWay method, an implementation MUST throw a WebServiceException if there is any error in the
+   // configuration of the Dispatch instance or if an error is detected1 during the remote operation invocation.
+   private void handleInvokeException(Exception ex)
+   {
+      if (ex instanceof WebServiceException)
+      {
+         throw (WebServiceException)ex;
+      }
+      
+      String msg = "Cannot dispatch message";
+      log.error(msg, ex);
+      throw new WebServiceException(msg, ex);
+   }
+
    public Map<String, Object> getRequestContext()
    {
       return bindingProvider.getRequestContext();
@@ -298,12 +320,41 @@
 
       public void run()
       {
-         Object result = invoke(payload);
-         response.set(result);
+         try
+         {
+            Map<String, Object> resContext = response.getContext();
+            Object result = invokeInternal(payload, resContext);
+            response.set(result);
 
-         // Call the handler if available
-         if (handler != null)
-            handler.handleResponse(response);
+            // 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/client/ResponseImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/client/ResponseImpl.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -31,6 +31,7 @@
 import java.util.concurrent.TimeoutException;
 
 import javax.xml.ws.Response;
+import javax.xml.ws.WebServiceException;
 
 /**
  * The Response interface provides methods used to obtain the payload and context of a 
@@ -43,8 +44,15 @@
 {
    private Future delegate;
    private Object result;
+   private WebServiceException exception;
    private Map<String, Object> context = new HashMap<String, Object>();
 
+   
+   public void setException(WebServiceException ex)
+   {
+      this.exception = ex;
+   }
+
    public Future getFuture()
    {
       if (delegate == null)
@@ -58,7 +66,7 @@
       this.delegate = delegate;
    }
 
-   public Map getContext()
+   public Map<String, Object> getContext()
    {
       return context;
    }
@@ -79,6 +87,10 @@
       {
          getFuture().get();
       }
+      
+      if (exception != null)
+         throw new ExecutionException(exception);
+      
       return result;
    }
 
@@ -88,6 +100,10 @@
       {
          getFuture().get(timeout, unit);
       }
+      
+      if (exception != null)
+         throw new ExecutionException(exception);
+      
       return result;
    }
 

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/BindingProviderImpl.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -35,6 +35,7 @@
 
 import org.jboss.ws.common.CommonBindingProvider;
 import org.jboss.ws.metadata.EndpointMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
 
 /**
  * The BindingProvider interface provides access to the protocol binding and associated context objects 
@@ -55,11 +56,11 @@
    
    public BindingProviderImpl(String bindingId)
    {
-      super(bindingId);
+      super(bindingId, Type.JAXWS);
    }
 
    @Override
-   protected void initBinding(String bindingId)
+   protected void initBinding(String bindingId, Type type)
    {
       if (epMetaData != null && epMetaData.getServiceMode() == Mode.MESSAGE)
       {

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP11BindingJAXWS.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -27,23 +27,58 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.soap.SOAPBinding;
 
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.CommonMessageContext;
 import org.jboss.ws.common.CommonSOAP11Binding;
+import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.soap.MessageContextAssociation;
 
 /**
- * The SOAP11Binding  
+ * The JAXWS SOAP11Binding  
  * 
  * @author Thomas.Diesler at jboss.com
  * @since 04-Jul-2006
  */
 public class SOAP11BindingJAXWS extends CommonSOAP11Binding implements BindingExt, SOAPBinding
 {
+   // provide logging
+   private static Logger log = Logger.getLogger(SOAP11BindingJAXWS.class);
+
    // Delegate to JAXWS SOAP binding
    private SOAPBindingDelegate delegate = new SOAPBindingDelegate();
    
+   public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+      String soapAction = opMetaData.getSOAPAction();
+
+      // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted value equal to the value of the soapAction attribute of
+      // soapbind:operation, if present in the corresponding WSDL description.
+
+      // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted empty string value, if in the corresponding WSDL description,
+      // the soapAction attribute of soapbind:operation is either not present, or
+      // present with an empty string as its value.
+
+      if (msgContext.getProperty(BindingProvider.SOAPACTION_USE_PROPERTY) != null)
+         log.info("Ignore BindingProvider.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+      String soapActionProperty = (String)msgContext.getProperty(BindingProvider.SOAPACTION_URI_PROPERTY);
+      if (soapActionProperty != null)
+         soapAction = soapActionProperty;
+
+      mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+   }
+   
    public Set<URI> getRoles()
    {
       return delegate.getRoles();

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/core/SOAP12BindingJAXWS.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -27,11 +27,18 @@
 import java.util.List;
 import java.util.Set;
 
+import javax.xml.soap.MimeHeaders;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.BindingProvider;
 import javax.xml.ws.handler.Handler;
 import javax.xml.ws.soap.SOAPBinding;
 
+import org.jboss.logging.Logger;
+import org.jboss.ws.common.CommonMessageContext;
 import org.jboss.ws.common.CommonSOAP12Binding;
+import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.HandlerMetaData.HandlerType;
+import org.jboss.ws.soap.MessageContextAssociation;
 
 /**
  * The SOAP11Binding  
@@ -41,9 +48,37 @@
  */
 public class SOAP12BindingJAXWS extends CommonSOAP12Binding implements BindingExt, SOAPBinding
 {
+   // provide logging
+   private static Logger log = Logger.getLogger(SOAP12BindingJAXWS.class);
+
    // Delegate to JAXWS SOAP binding
    private SOAPBindingDelegate delegate = new SOAPBindingDelegate();
    
+   public void setSOAPActionHeader(OperationMetaData opMetaData, SOAPMessage reqMessage)
+   {
+      CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
+      MimeHeaders mimeHeaders = reqMessage.getMimeHeaders();
+      String soapAction = opMetaData.getSOAPAction();
+
+      // R2744 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted value equal to the value of the soapAction attribute of
+      // soapbind:operation, if present in the corresponding WSDL description.
+
+      // R2745 A HTTP request MESSAGE MUST contain a SOAPAction HTTP header field
+      // with a quoted empty string value, if in the corresponding WSDL description,
+      // the soapAction attribute of soapbind:operation is either not present, or
+      // present with an empty string as its value.
+
+      if (msgContext.getProperty(BindingProvider.SOAPACTION_USE_PROPERTY) != null)
+         log.info("Ignore BindingProvider.SOAPACTION_USE_PROPERTY because of BP-1.0 R2745, R2745");
+
+      String soapActionProperty = (String)msgContext.getProperty(BindingProvider.SOAPACTION_URI_PROPERTY);
+      if (soapActionProperty != null)
+         soapAction = soapActionProperty;
+
+      mimeHeaders.addHeader("SOAPAction", soapAction != null ? soapAction : "");
+   }
+   
    public Set<URI> getRoles()
    {
       return delegate.getRoles();

Modified: branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java
===================================================================
--- branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/main/java/org/jboss/ws/jaxws/handler/HandlerChainExecutor.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -118,11 +118,10 @@
                }
             }
          }
-         catch (RuntimeException e)
+         catch (Exception ex)
          {
-            log.error("RuntimeException in request handler", e);
             doNext = false;
-            throw e;
+            processHandlerFailure(ex);
          }
          finally
          {
@@ -176,11 +175,10 @@
                }
             }
          }
-         catch (RuntimeException rte)
+         catch (Exception ex)
          {
-            log.error("RuntimeException in response handler", rte);
             doNext = false;
-            throw rte;
+            processHandlerFailure(ex);
          }
          finally
          {
@@ -231,11 +229,10 @@
                }
             }
          }
-         catch (RuntimeException e)
+         catch (Exception ex)
          {
-            log.error("RuntimeException in fault handler", e);
             doNext = false;
-            throw e;
+            processHandlerFailure(ex);
          }
          finally
          {
@@ -251,6 +248,20 @@
       return doNext;
    }
 
+   // 4.14 Conformance (Exceptions During Handler Processing): Exceptions thrown during handler processing on
+   // the client MUST be passed on to the application. If the exception in question is a subclass of WebService-
+   // Exception then an implementation MUST rethrow it as-is, without any additional wrapping, otherwise it
+   // MUST throw a WebServiceException whose cause is set to the exception that was thrown during handler processing.
+   private void processHandlerFailure(Exception ex)
+   {
+      log.error("Exception during handler processing", ex);
+      if (ex instanceof WebServiceException)
+      {
+         throw (WebServiceException)ex;
+      }
+      throw new WebServiceException(ex);
+   }
+
    private boolean handleMessage(Handler currHandler, SOAPMessageContextJAXWS soapContext)
    {
       MessageContext handlerContext = soapContext;

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/binding/SOAPBindingTestCase.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -46,6 +46,7 @@
 import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
 import org.jboss.ws.metadata.ParameterMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 import org.jboss.ws.utils.DOMUtils;
@@ -167,7 +168,8 @@
     */
    public void testBindRequestMessage() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       EndpointInvocation epInv = new EndpointInvocation(opMetaData);
       epInv.initInputParams(new Object[]{"Hello World!"});
@@ -185,7 +187,8 @@
     */
    public void testBindRequestMessageWithBoundHeader() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       // Add bound header
       QName xmlName = new QName("http://somens", "String_2");
@@ -209,7 +212,8 @@
     */
    public void testBindRequestMessageWithUnboundHeader() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       // Add unbound header
       QName xmlName = new QName("http://somens", "String_2");
@@ -235,7 +239,8 @@
     */
    public void testUnbindRequestMessage() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(reqEnvelope.getBytes());
 
@@ -271,7 +276,8 @@
       CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setSOAPMessage(reqMessage);
 
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
       EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
       assertNotNull(epInv);
 
@@ -293,7 +299,8 @@
       CommonMessageContext msgContext = MessageContextAssociation.peekMessageContext();
       msgContext.setSOAPMessage(reqMessage);
 
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
       EndpointInvocation epInv = binding.unbindRequestMessage(opMetaData, reqMessage);
       assertNotNull(epInv);
 
@@ -306,7 +313,8 @@
     */
    public void testBindResponseMessage() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       EndpointInvocation epInv = new EndpointInvocation(opMetaData);
       epInv.setReturnValue("Hello World!");
@@ -324,7 +332,8 @@
     */
    public void testUnbindResponseMessage() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelope.getBytes());
 
@@ -343,7 +352,8 @@
     */
    public void testUnbindResponseMessageWithBoundHeader() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithBoundHeader.getBytes());
 
@@ -372,7 +382,8 @@
     */
    public void testUnbindResponseMessageWithUnboundHeader() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithUnboundHeader.getBytes());
 
@@ -399,7 +410,8 @@
     */
    public void testUnbindFaultResponse() throws Exception
    {
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP12HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       ByteArrayInputStream inputStream = new ByteArrayInputStream(resEnvelopeWithFault.getBytes());
 

Modified: branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java
===================================================================
--- branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java	2006-09-20 10:43:06 UTC (rev 1022)
+++ branches/tdiesler/trunk/src/test/java/org/jboss/test/ws/common/soap/attachment/GenericAttachmentTestCase.java	2006-09-20 13:13:49 UTC (rev 1023)
@@ -48,6 +48,7 @@
 import org.jboss.ws.jaxrpc.CallImpl;
 import org.jboss.ws.jaxrpc.handler.SOAPMessageContextJAXRPC;
 import org.jboss.ws.metadata.OperationMetaData;
+import org.jboss.ws.metadata.EndpointMetaData.Type;
 import org.jboss.ws.soap.MessageContextAssociation;
 import org.jboss.ws.soap.MessageFactoryImpl;
 import org.jboss.ws.soap.attachment.MimeConstants;
@@ -145,7 +146,8 @@
       MessageContextAssociation.pushMessageContext(messageContext);
       messageContext.setOperationMetaData(opMetaData);
 
-      CommonBinding binding = (CommonBinding)new CommonBindingProvider(CommonSOAPBinding.SOAP11HTTP_BINDING).getCommonBinding();
+      CommonBindingProvider bindingProvider = new CommonBindingProvider(CommonSOAPBinding.SOAP11HTTP_BINDING, Type.JAXRPC);
+      CommonBinding binding = (CommonBinding)bindingProvider.getCommonBinding();
 
       EndpointInvocation epInv = new EndpointInvocation(opMetaData);
       epInv.initInputParams(new Object[]{"Hello World!", "hi"});




More information about the jboss-svn-commits mailing list