You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pr...@apache.org on 2007/07/05 00:02:45 UTC

svn commit: r553341 - in /webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws: ./ binding/ client/dispatch/ client/proxy/ core/controller/ feature/ feature/config/ feature/util/ spi/

Author: pradine
Date: Wed Jul  4 15:02:44 2007
New Revision: 553341

URL: http://svn.apache.org/viewvc?view=rev&rev=553341
Log:
Create a framework to support WebServiceFeatures. Add most of the support for AddressingFeature and MTOMFeature, on the client-side.

Added:
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureConfigurator.java
      - copied, changed from r551872, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/util/WebServiceFeatureConfigurator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/AddressingConfigurator.java
      - copied, changed from r551872, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/W3CAndSubmissionAddressingConfigurator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Binding.java
Removed:
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/W3CAndSubmissionAddressingConfigurator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/util/
Modified:
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureValidator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/MTOMConfigurator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/RespectBindingConfigurator.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java
    webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Wed Jul  4 15:02:44 2007
@@ -18,6 +18,7 @@
  */
 package org.apache.axis2.jaxws;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReferenceHelper;
 import org.apache.axis2.addressing.metadata.ServiceName;
 import org.apache.axis2.addressing.metadata.WSDLLocation;
@@ -29,7 +30,6 @@
 import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
-import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
 import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
@@ -56,18 +56,11 @@
 
     protected ServiceDelegate serviceDelegate;
     
-    protected WebServiceFeatureValidator validator;
-    
-    //TODO: Is this the best place for this code?
     protected org.apache.axis2.addressing.EndpointReference epr;
     
-    //TODO: Is this the best place for this code?
     protected String addressingNamespace;
 
-    private Binding binding = null;
-    
-    private EndpointReferenceFactory eprFactory =
-        (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
+    private org.apache.axis2.jaxws.spi.Binding binding = null;
 
     public BindingProvider(ServiceDelegate svcDelegate,
                            EndpointDescription epDesc,
@@ -78,15 +71,14 @@
         this.serviceDelegate = svcDelegate;
         this.epr = epr;
         this.addressingNamespace = addressingNamespace;
-        this.validator = new WebServiceFeatureValidator(false, features);
         
-        initialize();
+        initialize(features);
     }
 
     /*
      * Initialize any objects needed by the BindingProvider
      */
-    private void initialize() {
+    private void initialize(WebServiceFeature... features) {
         requestContext = new ValidatingClientContext();
         responseContext = new ValidatingClientContext();
         
@@ -102,16 +94,15 @@
         
         // JAXWS 9.2.1.1 requires that we go ahead and create the binding object
         // so we can also set the handlerchain
-        if (binding == null) {
-            binding = BindingUtils.createBinding(endpointDesc);
-            
-            // TODO should we allow the ServiceDelegate to figure out the default handlerresolver?  Probably yes, since a client app may look for one there.
-            HandlerResolver handlerResolver =
-                    serviceDelegate.getHandlerResolver() != null ? serviceDelegate.getHandlerResolver()
-                            : new HandlerResolverImpl(endpointDesc);
-            binding.setHandlerChain(handlerResolver.getHandlerChain(endpointDesc.getPortInfo()));
-        }
-
+        binding = (org.apache.axis2.jaxws.spi.Binding) BindingUtils.createBinding(endpointDesc);
+        
+        // TODO should we allow the ServiceDelegate to figure out the default handlerresolver?  Probably yes, since a client app may look for one there.
+        HandlerResolver handlerResolver =
+            serviceDelegate.getHandlerResolver() != null ? serviceDelegate.getHandlerResolver()
+                    : new HandlerResolverImpl(endpointDesc);
+        binding.setHandlerChain(handlerResolver.getHandlerChain(endpointDesc.getPortInfo()));
+        
+        binding.setWebServiceFeatures(features);
     }
 
     public ServiceDelegate getServiceDelegate() {
@@ -125,10 +116,6 @@
     public Binding getBinding() {
         return binding;
     }
-    
-    public void setBinding(Binding binding) {
-        this.binding = binding;
-    }
 
     public Map<String, Object> getRequestContext() {
         return requestContext;
@@ -226,68 +213,52 @@
     }
 
     public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
-        T jaxwsEPR = null;
-        String bindingID = endpointDesc.getClientBindingID();
-        String addressingNamespace = eprFactory.getAddressingNamespace(clazz);
-        
-        if (BindingUtils.isSOAPBinding(bindingID)) {
-            try {
-                if (epr == null) {
-                    String address = endpointDesc.getEndpointAddress();
-                    org.apache.axis2.addressing.EndpointReference epr =
-                        new org.apache.axis2.addressing.EndpointReference(address);
-                    QName service = endpointDesc.getServiceQName();
-                    QName port = endpointDesc.getPortQName();
-                    URL wsdlURL = ((ServiceDescriptionWSDL) endpointDesc.getServiceDescription()).getWSDLLocation();
-                    ServiceName serviceName = new ServiceName(service, port.getLocalPart());
-                    WSDLLocation wsdlLocation = new WSDLLocation(port.getNamespaceURI(), wsdlURL.toString());
-                    EndpointReferenceHelper.setServiceNameMetadata(epr, addressingNamespace, serviceName);
-                    EndpointReferenceHelper.setWSDLLocationMetadata(epr, addressingNamespace, wsdlLocation);
-                    this.epr = epr;
-                    this.addressingNamespace = addressingNamespace;
-                }
-                else if (!addressingNamespace.equals(this.addressingNamespace)) {
-                    String address = this.epr.getAddress();
-                    org.apache.axis2.addressing.EndpointReference epr =
-                        new org.apache.axis2.addressing.EndpointReference(address);
-                    QName service = endpointDesc.getServiceQName();
-                    QName port = endpointDesc.getPortQName();
-                    URL wsdlURL = ((ServiceDescriptionWSDL) endpointDesc.getServiceDescription()).getWSDLLocation();
-                    ServiceName serviceName = new ServiceName(service, port.getLocalPart());
-                    WSDLLocation wsdlLocation = new WSDLLocation(port.getNamespaceURI(), wsdlURL.toString());
-                    EndpointReferenceHelper.setServiceNameMetadata(epr, addressingNamespace, serviceName);
-                    EndpointReferenceHelper.setWSDLLocationMetadata(epr, addressingNamespace, wsdlLocation);
-                    EndpointReferenceHelper.transferReferenceParameters(this.epr, epr);
-                    this.epr = epr;
-                    this.addressingNamespace = addressingNamespace;                    
-                }
-            
-                jaxwsEPR = clazz.cast(EndpointReferenceConverter.convertFromAxis2(epr, addressingNamespace));
-            }
-            catch (Exception e) {
-                //TODO NLS enable.
-                throw ExceptionFactory.makeWebServiceException("Error creating endpoint reference", e);
-            }
+        EndpointReference jaxwsEPR = null;
+        String addressingNamespace = getAddressingNamespace(clazz);
+        
+        if (!BindingUtils.isSOAPBinding(binding.getBindingID()))
+            throw new UnsupportedOperationException("This method is unsupported for the binding: " + binding.getBindingID());
+        
+        try {
+            org.apache.axis2.addressing.EndpointReference epr =
+                getAxis2EndpointReference(addressingNamespace);
+            jaxwsEPR = EndpointReferenceConverter.convertFromAxis2(epr, addressingNamespace);
         }
-        else {
+        catch (Exception e) {
             //TODO NLS enable.
-            throw new UnsupportedOperationException("This method is not supported with a binding of " + bindingID);
+            throw ExceptionFactory.makeWebServiceException("Error creating endpoint reference", e);
+        }
+        
+        return clazz.cast(jaxwsEPR);
+    }
+
+    public org.apache.axis2.addressing.EndpointReference getAxis2EndpointReference(String addressingNamespace) throws AxisFault {
+        org.apache.axis2.addressing.EndpointReference epr = this.epr;
+        
+        if (epr == null || !addressingNamespace.equals(this.addressingNamespace)) {
+            String address = endpointDesc.getEndpointAddress();
+            epr = new org.apache.axis2.addressing.EndpointReference(address);
+            QName service = endpointDesc.getServiceQName();
+            QName port = endpointDesc.getPortQName();
+            URL wsdlURL = ((ServiceDescriptionWSDL) endpointDesc.getServiceDescription()).getWSDLLocation();
+            ServiceName serviceName = new ServiceName(service, port.getLocalPart());
+            WSDLLocation wsdlLocation = new WSDLLocation(port.getNamespaceURI(), wsdlURL.toString());
+            EndpointReferenceHelper.setServiceNameMetadata(epr, addressingNamespace, serviceName);
+            EndpointReferenceHelper.setWSDLLocationMetadata(epr, addressingNamespace, wsdlLocation);
         }
         
-        return jaxwsEPR;
+        return epr;
     }
     
     public String getAddressingNamespace() {
         return addressingNamespace;
     }
 
-    public org.apache.axis2.addressing.EndpointReference getAxis2EndpointReference() {
-        return epr;
-    }    
-
-    public WebServiceFeatureValidator getWebServiceFeatureValidator() {
-        return validator;
-    }    
+    private String getAddressingNamespace(Class clazz) {
+        EndpointReferenceFactory eprFactory =
+            (EndpointReferenceFactory) FactoryRegistry.getFactory(EndpointReferenceFactory.class);
+        return eprFactory.getAddressingNamespace(clazz);
+    }
     
     /*
     * An inner class used to validate properties as they are set by the client.

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingImpl.java Wed Jul  4 15:02:44 2007
@@ -18,10 +18,17 @@
  */
 package org.apache.axis2.jaxws.binding;
 
+import org.apache.axis2.jaxws.core.MessageContext;
 import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
+import org.apache.axis2.jaxws.feature.config.RespectBindingConfigurator;
 import org.apache.axis2.jaxws.handler.HandlerResolverImpl;
+import org.apache.axis2.jaxws.spi.Binding;
+import org.apache.axis2.jaxws.spi.BindingProvider;
 
-import javax.xml.ws.Binding;
+import javax.xml.ws.RespectBindingFeature;
+import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.handler.Handler;
 
 import java.util.ArrayList;
@@ -32,7 +39,9 @@
  * @author rott classes that would normally "implement javax.xml.ws.Binding"
  *         should extend this class instead.
  */
-public class BindingImpl implements Binding {
+public abstract class BindingImpl implements Binding {
+    private static final WebServiceFeatureConfigurator RESPECT_BINDING_CONFIGURATOR =
+        new RespectBindingConfigurator();
 
     // an unsorted list of handlers
     private List<Handler> handlers = null;
@@ -42,15 +51,13 @@
     private EndpointDescription endpointDesc;
 
     protected Set<String> roles = null;
+    
+    protected WebServiceFeatureValidator validator = null;
 
     protected static final String SOAP11_ENV_NS = "http://schemas.xmlsoap.org/soap/envelope/";
 
     protected static final String SOAP12_ENV_NS = "http://www.w3.org/2003/05/soap-envelope";
 
-    public BindingImpl(String bindingId) {
-        this.bindingId = bindingId;
-    }
-
     public BindingImpl(EndpointDescription endpointDesc) {
         this.endpointDesc = endpointDesc;
         // client
@@ -58,6 +65,9 @@
         if (this.bindingId == null)
             // server
             this.bindingId = endpointDesc.getBindingType();
+        
+        validator = new WebServiceFeatureValidator();
+        validator.addConfigurator(RespectBindingFeature.ID, RESPECT_BINDING_CONFIGURATOR);
     }
 
     public List<Handler> getHandlerChain() {
@@ -86,5 +96,21 @@
      */
     public String getBindingID() {
         return this.bindingId;
+    }
+
+    public void configure(MessageContext messageContext, BindingProvider provider) {
+        validator.configure(messageContext, provider);
+    }
+
+    public WebServiceFeature getWebServiceFeature(String id) {
+        return validator.getFeature(id);
+    }
+
+    public void setWebServiceFeatures(WebServiceFeature... features) {
+        if (features != null) {
+            for (WebServiceFeature feature : features) {
+                validator.addFeature(feature);
+            }
+        }
     }
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/BindingUtils.java Wed Jul  4 15:02:44 2007
@@ -34,7 +34,10 @@
             // Do we default to the SOAPBinding?            
         }
         
-        String bindingType = ed.getBindingType();
+        String bindingType = ed.getClientBindingID();
+        if (bindingType == null)
+            bindingType = ed.getBindingType();
+        
         if (BindingUtils.isSOAPBinding(bindingType)) {
             return new SOAPBinding(ed);
         }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/binding/SOAPBinding.java Wed Jul  4 15:02:44 2007
@@ -19,8 +19,11 @@
 package org.apache.axis2.jaxws.binding;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.i18n.Messages;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.feature.config.MTOMConfigurator;
+import org.apache.axis2.jaxws.feature.config.AddressingConfigurator;
 import org.apache.axis2.jaxws.utility.SAAJFactory;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -30,8 +33,9 @@
 import javax.xml.soap.SOAPException;
 import javax.xml.soap.SOAPFactory;
 import javax.xml.ws.WebServiceException;
+import javax.xml.ws.soap.AddressingFeature;
+import javax.xml.ws.soap.MTOMFeature;
 
-import java.util.AbstractSet;
 import java.util.HashSet;
 import java.util.Set;
 
@@ -42,6 +46,10 @@
  * explicitly specificied.
  */
 public class SOAPBinding extends BindingImpl implements javax.xml.ws.soap.SOAPBinding {
+    private static final WebServiceFeatureConfigurator ADDRESSING_CONFIGURATOR =
+        new AddressingConfigurator();
+    private static final WebServiceFeatureConfigurator MTOM_CONFIGURATOR =
+        new MTOMConfigurator();
 
     private boolean mtomEnabled = false;
 
@@ -49,6 +57,15 @@
 
     public SOAPBinding(EndpointDescription endpointDesc) {
         super(endpointDesc);
+        
+        validator.addConfigurator(AddressingFeature.ID, ADDRESSING_CONFIGURATOR);
+        validator.addConfigurator(SubmissionAddressingFeature.ID, ADDRESSING_CONFIGURATOR);
+        validator.addConfigurator(MTOMFeature.ID, MTOM_CONFIGURATOR);
+        
+        if (SOAPBinding.SOAP11HTTP_MTOM_BINDING.equalsIgnoreCase(bindingId) ||
+                SOAPBinding.SOAP12HTTP_MTOM_BINDING.equalsIgnoreCase(bindingId)) {
+            setMTOMEnabled(true);
+        }
     }
 
     /*

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/dispatch/BaseDispatch.java Wed Jul  4 15:02:44 2007
@@ -47,10 +47,10 @@
 import org.apache.axis2.jaxws.core.controller.AxisInvocationController;
 import org.apache.axis2.jaxws.core.controller.InvocationController;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigUtil;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.marshaller.impl.alt.MethodMarshallerUtils;
 import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.jaxws.spi.Constants;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
 import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
@@ -133,7 +133,8 @@
              */
 
             // be sure to use whatever handlerresolver is registered on the Service
-            invocationContext.setHandlers(getBinding().getHandlerChain());
+            Binding binding = (Binding) getBinding();
+            invocationContext.setHandlers(binding.getHandlerChain());
 
             Message requestMsg = null;
             try {
@@ -146,6 +147,7 @@
                 throw getProtocolException(e);
             }
 
+            setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
 
             // Migrate the properties from the client request context bag to
@@ -154,10 +156,8 @@
                     Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                     getRequestContext(), requestMsgCtx);
 
-            // Perform the client-side configuration, as specified during the invocation.
-            WebServiceFeatureConfigUtil.performConfiguration(
-                    Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID,
-                    requestMsgCtx, this);
+            // Perform the WebServiceFeature configuration requested by the user.
+            binding.configure(requestMsgCtx, this);
 
             // Send the request using the InvocationController
             ic.invoke(invocationContext);
@@ -213,6 +213,21 @@
             MessageContext requestMsgCtx = new MessageContext();
             requestMsgCtx.setEndpointDescription(getEndpointDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
+            
+            /*
+             * TODO: review: make sure the handlers are set on the InvocationContext
+             * This implementation of the JAXWS runtime does not use Endpoint, which
+             * would normally be the place to initialize and store the handler list.
+             * In lieu of that, we will have to intialize and store them on the 
+             * InvocationContext.  also see the InvocationContextFactory.  On the client
+             * side, the binding is not yet set when we call into that factory, so the
+             * handler list doesn't get set on the InvocationContext object there.  Thus
+             * we gotta do it here.
+             */
+
+            // be sure to use whatever handlerresolver is registered on the Service
+            Binding binding = (Binding) getBinding();
+            invocationContext.setHandlers(binding.getHandlerChain());
 
             Message requestMsg = null;
             try {
@@ -225,6 +240,7 @@
                 throw getProtocolException(e);
             }
 
+            setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
 
             // Migrate the properties from the client request context bag to
@@ -233,10 +249,8 @@
                     Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                     getRequestContext(), requestMsgCtx);
 
-            // Perform the client-side configuration, as specified during the invocation.
-            WebServiceFeatureConfigUtil.performConfiguration(
-                    Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID,
-                    requestMsgCtx, this);
+            // Perform the WebServiceFeature configuration requested by the user.
+            binding.configure(requestMsgCtx, this);
 
             // Send the request using the InvocationController
             ic.invokeOneWay(invocationContext);
@@ -275,6 +289,21 @@
             MessageContext requestMsgCtx = new MessageContext();
             requestMsgCtx.setEndpointDescription(getEndpointDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
+            
+            /*
+             * TODO: review: make sure the handlers are set on the InvocationContext
+             * This implementation of the JAXWS runtime does not use Endpoint, which
+             * would normally be the place to initialize and store the handler list.
+             * In lieu of that, we will have to intialize and store them on the 
+             * InvocationContext.  also see the InvocationContextFactory.  On the client
+             * side, the binding is not yet set when we call into that factory, so the
+             * handler list doesn't get set on the InvocationContext object there.  Thus
+             * we gotta do it here.
+             */
+
+            // be sure to use whatever handlerresolver is registered on the Service
+            Binding binding = (Binding) getBinding();
+            invocationContext.setHandlers(binding.getHandlerChain());
 
             Message requestMsg = null;
             if (isValidInvocationParam(obj)) {
@@ -283,6 +312,7 @@
                 throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchInvalidParam"));
             }
 
+            setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
 
             // Migrate the properties from the client request context bag to
@@ -291,10 +321,8 @@
                     Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                     getRequestContext(), requestMsgCtx);
 
-            // Perform the client-side configuration, as specified during the invocation.
-            WebServiceFeatureConfigUtil.performConfiguration(
-                    Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID,
-                    requestMsgCtx, this);
+            // Perform the WebServiceFeature configuration requested by the user.
+            binding.configure(requestMsgCtx, this);
 
             // Setup the Executor that will be used to drive async responses back to 
             // the client.
@@ -344,6 +372,21 @@
             MessageContext requestMsgCtx = new MessageContext();
             requestMsgCtx.setEndpointDescription(getEndpointDescription());
             invocationContext.setRequestMessageContext(requestMsgCtx);
+            
+            /*
+             * TODO: review: make sure the handlers are set on the InvocationContext
+             * This implementation of the JAXWS runtime does not use Endpoint, which
+             * would normally be the place to initialize and store the handler list.
+             * In lieu of that, we will have to intialize and store them on the 
+             * InvocationContext.  also see the InvocationContextFactory.  On the client
+             * side, the binding is not yet set when we call into that factory, so the
+             * handler list doesn't get set on the InvocationContext object there.  Thus
+             * we gotta do it here.
+             */
+
+            // be sure to use whatever handlerresolver is registered on the Service
+            Binding binding = (Binding) getBinding();
+            invocationContext.setHandlers(binding.getHandlerChain());
 
             Message requestMsg = null;
             if (isValidInvocationParam(obj)) {
@@ -352,6 +395,7 @@
                 throw ExceptionFactory.makeWebServiceException(Messages.getMessage("dispatchInvalidParam"));
             }
 
+            setupMessageProperties(requestMsg);
             requestMsgCtx.setMessage(requestMsg);
 
             // Migrate the properties from the client request context bag to
@@ -360,10 +404,8 @@
                     Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID,
                     getRequestContext(), requestMsgCtx);
 
-            // Perform the client-side configuration, as specified during the invocation.
-            WebServiceFeatureConfigUtil.performConfiguration(
-                    Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID,
-                    requestMsgCtx, this);
+            // Perform the WebServiceFeature configuration requested by the user.
+            binding.configure(requestMsgCtx, this);
 
             // Setup the Executor that will be used to drive async responses back to 
             // the client.
@@ -474,6 +516,20 @@
             return true;
         else
             return false;
+    }
+
+    /*
+     * Configure any properties that will be needed on the Message
+     */
+    private void setupMessageProperties(Message msg) {
+        // If the user has enabled MTOM on the SOAPBinding, we need
+        // to make sure that gets pushed to the Message object.
+        Binding binding = (Binding) getBinding();
+        if (binding != null && binding instanceof SOAPBinding) {
+            SOAPBinding soapBinding = (SOAPBinding)binding;
+            if (soapBinding.isMTOMEnabled())
+                msg.setMTOMEnabled(true);
+        }
     }
 
     /*

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Wed Jul  4 15:02:44 2007
@@ -30,10 +30,10 @@
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigUtil;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
 import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.jaxws.spi.Constants;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
 import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
@@ -43,6 +43,8 @@
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Response;
 import javax.xml.ws.WebServiceFeature;
+import javax.xml.ws.soap.SOAPBinding;
+
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
@@ -172,6 +174,15 @@
         request.setEndpointDescription(getEndpointDescription());
         request.setOperationDescription(operationDesc);
 
+        // Enable MTOM on the Message if the property was set on the SOAPBinding.
+        Binding bnd = (Binding) getBinding();
+        if (bnd != null && bnd instanceof SOAPBinding) {
+            if (((SOAPBinding)bnd).isMTOMEnabled()) {
+                Message requestMsg = request.getMessage();
+                requestMsg.setMTOMEnabled(true);
+            }
+        }
+        
         /*
          * TODO: review: make sure the handlers are set on the InvocationContext
          * This implementation of the JAXWS runtime does not use Endpoint, which
@@ -184,7 +195,7 @@
          */
         
         // be sure to use whatever handlerresolver is registered on the Service
-        requestIC.setHandlers(getBinding().getHandlerChain());
+        requestIC.setHandlers(bnd.getHandlerChain());
 
         requestIC.setRequestMessageContext(request);
         requestIC.setServiceClient(serviceDelegate.getServiceClient(endpointDesc.getPortQName()));
@@ -195,10 +206,8 @@
                 Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, 
                 getRequestContext(), request);
 
-        // Perform the client-side configuration, as specified during the invocation.
-        WebServiceFeatureConfigUtil.performConfiguration(
-                Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID,
-                request, this);
+        // Perform the WebServiceFeature configuration requested by the user.
+        bnd.configure(request, this);
 
         // TODO: Change this to some form of factory so that we can change the IC to
         // a more simple one for marshaller/unmarshaller testing.

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/core/controller/AxisInvocationController.java Wed Jul  4 15:02:44 2007
@@ -488,7 +488,6 @@
             ops.setProperty(key, value);
         }
 
-        //TODO Do I have to leave this here or can I move it to the MTOMConfigurator.
         // Enable MTOM
         Message msg = mc.getMessage();
         if (msg.isMTOMEnabled()) {

Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureConfigurator.java (from r551872, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/util/WebServiceFeatureConfigurator.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureConfigurator.java?view=diff&rev=553341&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/util/WebServiceFeatureConfigurator.java&r1=551872&p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureConfigurator.java&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/util/WebServiceFeatureConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureConfigurator.java Wed Jul  4 15:02:44 2007
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- *      
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.jaxws.feature.util;
-
-import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.spi.BindingProvider;
-
-/**
- * 
- */
-public interface WebServiceFeatureConfigurator {
-
-    /**
-     * Perform client-side configuration for a <code>WebServiceFeature</code>.
-     * 
-     * @param messageContext
-     * @param provider
-     */
-    public void performConfiguration(MessageContext messageContext, BindingProvider provider);
-
-    /**
-     * Perform server-side configuration for a <code>WebServiceFeature</code>.
-     * 
-     * @param serviceDescription
-     */
-    public void performConfiguration(ServiceDescription serviceDescription);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.feature;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.spi.BindingProvider;
+
+/**
+ * 
+ */
+public interface WebServiceFeatureConfigurator {
+
+    /**
+     * Perform client-side configuration for a <code>WebServiceFeature</code>.
+     * 
+     * @param messageContext
+     * @param provider
+     */
+    public void configure(MessageContext messageContext, BindingProvider provider);
+
+    /**
+     * Perform server-side configuration for a <code>WebServiceFeature</code>.
+     * 
+     * @param endpointDescription
+     */
+    public void configure(EndpointDescription endpointDescription);
+}

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureValidator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureValidator.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureValidator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/WebServiceFeatureValidator.java Wed Jul  4 15:02:44 2007
@@ -19,77 +19,64 @@
 package org.apache.axis2.jaxws.feature;
 
 import org.apache.axis2.jaxws.ExceptionFactory;
-import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.spi.BindingProvider;
 
-import javax.xml.ws.RespectBindingFeature;
 import javax.xml.ws.WebServiceFeature;
-import javax.xml.ws.soap.AddressingFeature;
-import javax.xml.ws.soap.MTOMFeature;
 
 import java.util.IdentityHashMap;
 import java.util.Map;
 
 public class WebServiceFeatureValidator {
-    private static final WebServiceFeature DEFAULT_ADDRESSING_FEATURE = new AddressingFeature();
-    private static final WebServiceFeature DEFAULT_SUBMISSION_ADDRESSING_FEATURE = new SubmissionAddressingFeature();
-    private static final WebServiceFeature DEFAULT_MTOM_FEATURE = new MTOMFeature();
-    private static final WebServiceFeature DEFAULT_RESPECT_BINDING_FEATURE = new RespectBindingFeature();
-
-    private static final WebServiceFeature DEFAULT_CLIENT_SIDE_ADDRESSING_FEATURE = new AddressingFeature(false);
-    private static final WebServiceFeature DEFAULT_CLIENT_SIDE_SUBMISSION_ADDRESSING_FEATURE = new SubmissionAddressingFeature(false);
-    private static final WebServiceFeature DEFAULT_CLIENT_SIDE_MTOM_FEATURE = new MTOMFeature(false);
-
     private static final WebServiceFeature[] ZERO_LENGTH_ARRAY = new WebServiceFeature[0];
     
+    private Map<String, WebServiceFeatureConfigurator> configuratorMap;
     private Map<String, WebServiceFeature> featureMap;
     
-    public WebServiceFeatureValidator(boolean isServerSide) {
-        //Set up default WebServiceFeatures.
+    public WebServiceFeatureValidator() {
+        configuratorMap = new IdentityHashMap<String, WebServiceFeatureConfigurator>();
         featureMap = new IdentityHashMap<String, WebServiceFeature>();
-        
-        if (isServerSide) {
-            featureMap.put(AddressingFeature.ID, DEFAULT_ADDRESSING_FEATURE);
-            featureMap.put(SubmissionAddressingFeature.ID, DEFAULT_SUBMISSION_ADDRESSING_FEATURE);
-            featureMap.put(MTOMFeature.ID, DEFAULT_MTOM_FEATURE);
-        }
-        else {
-            featureMap.put(AddressingFeature.ID, DEFAULT_CLIENT_SIDE_ADDRESSING_FEATURE);
-            featureMap.put(SubmissionAddressingFeature.ID, DEFAULT_CLIENT_SIDE_SUBMISSION_ADDRESSING_FEATURE);
-            featureMap.put(MTOMFeature.ID, DEFAULT_CLIENT_SIDE_MTOM_FEATURE);            
-        }
-        
-        featureMap.put(RespectBindingFeature.ID, DEFAULT_RESPECT_BINDING_FEATURE);        
     }
-
-    public WebServiceFeatureValidator(boolean isServerSide, WebServiceFeature... features) {
-        this(isServerSide);
-        
-        if (features != null) {
-            for (WebServiceFeature feature : features) {
-                put(feature);
-            }
-        }
+    
+    public void addConfigurator(String id, WebServiceFeatureConfigurator configurator) {
+        configuratorMap.put(id, configurator);
     }
     
     public boolean isValid(WebServiceFeature feature) {
-        return featureMap.containsKey(feature.getID());
+        if (feature == null)
+            return false;
+        
+        return configuratorMap.containsKey(feature.getID());
     }
-
-    public void put(WebServiceFeature feature) {
-        if (feature != null) {
-            //TODO NLS enable.
-            if (!isValid(feature))
-                throw ExceptionFactory.makeWebServiceException("Unrecognized WebServiceFeature " + feature.getID());
-            
-            featureMap.put(feature.getID(), feature);            
-        }
+    
+    public void addFeature(WebServiceFeature feature) {
+        //TODO NLS enable.
+        if (!isValid(feature))
+            throw ExceptionFactory.makeWebServiceException("Unrecognized WebServiceFeature " + feature.getID());
+        
+        featureMap.put(feature.getID(), feature);
     }
     
-    public WebServiceFeature get(String featureID) {
-        return featureMap.get(featureID);
+    public WebServiceFeature getFeature(String id) {
+        return featureMap.get(id);
     }
     
-    public WebServiceFeature[] getAll() {
+    public WebServiceFeature[] getAllFeatures() {
         return featureMap.values().toArray(ZERO_LENGTH_ARRAY);
+    }
+    
+    public void configure(MessageContext messageContext, BindingProvider provider) {
+        for (WebServiceFeature feature : getAllFeatures()) {
+            WebServiceFeatureConfigurator configurator = configuratorMap.get(feature.getID());
+            configurator.configure(messageContext, provider);
+        }
+    }
+    
+    public void configure(EndpointDescription endpointDescription) {
+        for (WebServiceFeature feature : getAllFeatures()) {
+            WebServiceFeatureConfigurator configurator = configuratorMap.get(feature.getID());
+            configurator.configure(endpointDescription);
+        }
     }
 }

Copied: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/AddressingConfigurator.java (from r551872, webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/W3CAndSubmissionAddressingConfigurator.java)
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/AddressingConfigurator.java?view=diff&rev=553341&p1=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/W3CAndSubmissionAddressingConfigurator.java&r1=551872&p2=webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/AddressingConfigurator.java&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/W3CAndSubmissionAddressingConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/AddressingConfigurator.java Wed Jul  4 15:02:44 2007
@@ -18,89 +18,157 @@
  */
 package org.apache.axis2.jaxws.feature.config;
 
-import java.util.Map;
-
-import javax.xml.ws.Binding;
 import javax.xml.ws.soap.AddressingFeature;
 
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.AddressingConstants.Final;
 import org.apache.axis2.addressing.AddressingConstants.Submission;
 import org.apache.axis2.engine.AxisConfiguration;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.addressing.SubmissionAddressingFeature;
-import org.apache.axis2.jaxws.binding.SOAPBinding;
 import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.spi.Binding;
 import org.apache.axis2.jaxws.spi.BindingProvider;
 
 /**
  *
  */
-public class W3CAndSubmissionAddressingConfigurator implements WebServiceFeatureConfigurator {
+public class AddressingConfigurator implements WebServiceFeatureConfigurator {
 
     /*
      *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
+     * @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
      */
-    public void performConfiguration(MessageContext messageContext, BindingProvider provider) {
-        Binding bnd = provider.getBinding();
-        if (bnd instanceof SOAPBinding) {
-            WebServiceFeatureValidator validator = provider.getWebServiceFeatureValidator();
-            AddressingFeature addressingFeature =
-                (AddressingFeature) validator.get(AddressingFeature.ID);
-            SubmissionAddressingFeature submissionAddressingFeature =
-                (SubmissionAddressingFeature) validator.get(SubmissionAddressingFeature.ID);
-            Map<String, Object> properties = messageContext.getProperties();
+    public void configure(MessageContext messageContext, BindingProvider provider) {
+        Binding bnd = (Binding) provider.getBinding();
+        AddressingFeature addressingFeature =
+            (AddressingFeature) bnd.getWebServiceFeature(AddressingFeature.ID);
+        SubmissionAddressingFeature submissionAddressingFeature =
+            (SubmissionAddressingFeature) bnd.getWebServiceFeature(SubmissionAddressingFeature.ID);
+        String specifiedAddressingNamespace = provider.getAddressingNamespace();
+        String enabledAddressingNamespace =
+            (String) messageContext.getProperty(AddressingConstants.WS_ADDRESSING_VERSION);
+        Boolean disableAddressing =
+            (Boolean) messageContext.getProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
+        
+        //Figure out which WS-Addressing feature was specified causing this configurator to run. 
+        if (addressingFeature != null && submissionAddressingFeature != null) {
+            //Both features must have been specified.
+            boolean w3cAddressingEnabled = addressingFeature.isEnabled();
+            boolean submissionAddressingEnabled = submissionAddressingFeature.isEnabled();
             
-            if (addressingFeature.isEnabled() || submissionAddressingFeature.isEnabled()) {
-                String addressingNamespace = provider.getAddressingNamespace();
+            if (w3cAddressingEnabled && submissionAddressingEnabled) {
+                //If WS-Addressing has already been enabled then stop,
+                //as this configurator has probably already run once.
+                if (!disableAddressing)
+                    return;
+                
+                //If an EPR hasn't been specified then default to 2005/08 addressing,
+                //else use the namespace of the EPR.
+                if (specifiedAddressingNamespace == null)
+                    specifiedAddressingNamespace = Final.WSA_NAMESPACE;
+                
+                disableAddressing = Boolean.FALSE;
+            }
+            else if (w3cAddressingEnabled) {
+                //Enable only 2005/08 addressing
+                if (Submission.WSA_NAMESPACE.equals(specifiedAddressingNamespace))
+                    throw ExceptionFactory.makeWebServiceException("Illegal configuration.");
+                else
+                    specifiedAddressingNamespace = Final.WSA_NAMESPACE;
+                
+                disableAddressing = Boolean.FALSE;
+            }
+            else if (submissionAddressingEnabled) {
+                //Enable only 2004/08 addressing
+                if (Final.WSA_NAMESPACE.equals(specifiedAddressingNamespace))
+                    throw ExceptionFactory.makeWebServiceException("Illegal configuration.");
+                else
+                    specifiedAddressingNamespace = Submission.WSA_NAMESPACE;
+                
+                disableAddressing = Boolean.FALSE;
+            }
+            else {
+                //Disable 2005/08 and 2004/08 addressing
+                disableAddressing = Boolean.TRUE;
+            }                
+        }
+        else if (addressingFeature != null) {
+            //The AddressingFeature must have been specified.
+            boolean w3cAddressingEnabled = addressingFeature.isEnabled();
+
+            if (w3cAddressingEnabled) {
+                //Enable 2005/08 addressing
+                if (Submission.WSA_NAMESPACE.equals(specifiedAddressingNamespace))
+                    throw ExceptionFactory.makeWebServiceException("Illegal configuration.");
+                else
+                    specifiedAddressingNamespace = Final.WSA_NAMESPACE;
                 
-                //Make sure that the feature that has been enabled and the addressing namespace
-                //are consistent with each other.
-                if (addressingFeature.isEnabled() && !submissionAddressingFeature.isEnabled()) {
-                    //TODO NLS enable.
-                    if (!Final.WSA_NAMESPACE.equals(addressingNamespace))
-                        throw ExceptionFactory.makeWebServiceException("The namespace of the endpoint reference is different to the namespace of the addressing WebServiceFeature.");
-                }
-                
-                if (submissionAddressingFeature.isEnabled() && !addressingFeature.isEnabled()) {
-                    //TODO NLS enable.
-                    if (!Submission.WSA_NAMESPACE.equals(addressingNamespace))
-                        throw ExceptionFactory.makeWebServiceException("The namespace of the endpoint reference is different to the namespace of the submission addressing WebServiceFeature.");
-                }
-                
-                org.apache.axis2.context.MessageContext msgContext = messageContext.getAxisMessageContext();
-                msgContext.setTo(provider.getAxis2EndpointReference());
-                
-                try {
-                    ServiceDescription sd = messageContext.getEndpointDescription().getServiceDescription();
-                    AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
-                    if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
-                        axisConfig.engageModule(Constants.MODULE_ADDRESSING);
-                }
-                catch (Exception e) {
-                    //TODO NLS enable.
-                    throw ExceptionFactory.makeWebServiceException("Unable to engage the addressing module.", e);
-                }
+                disableAddressing = Boolean.FALSE;
+            }
+            else {
+                //Disable 2005/08 addressing
+                if (enabledAddressingNamespace == null ||
+                        Final.WSA_NAMESPACE.equals(enabledAddressingNamespace))
+                    disableAddressing = Boolean.TRUE;
+            }                
+        }
+        else if (submissionAddressingFeature != null) {
+            //The SubmissionAddressingFeature must have been specified.
+            boolean submissionAddressingEnabled = submissionAddressingFeature.isEnabled();
+            
+            if (submissionAddressingEnabled) {
+                //Enable 2004/08 addressing
+                if (Final.WSA_NAMESPACE.equals(specifiedAddressingNamespace))
+                    throw ExceptionFactory.makeWebServiceException("Illegal configuration.");
+                else
+                    specifiedAddressingNamespace = Submission.WSA_NAMESPACE;
                 
-                properties.put(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.FALSE);
-                properties.put(AddressingConstants.WS_ADDRESSING_VERSION, addressingNamespace);                                
+                disableAddressing = Boolean.FALSE;
             }
             else {
-                properties.put(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, Boolean.TRUE);
+                //Disable 2004/08 addressing
+                if (enabledAddressingNamespace == null ||
+                        Submission.WSA_NAMESPACE.equals(enabledAddressingNamespace))
+                    disableAddressing = Boolean.TRUE;
+            }                
+        }
+        else {
+            //If neither were specified then this configurator should never run.
+            throw ExceptionFactory.makeWebServiceException("Both WS-Addressing features were unspecified.");
+        }
+        
+        if (!disableAddressing) {
+            try {
+                EndpointReference epr = provider.getAxis2EndpointReference(specifiedAddressingNamespace);
+                org.apache.axis2.context.MessageContext axis2MessageContext = messageContext.getAxisMessageContext();
+                axis2MessageContext.setTo(epr);
+                
+                ServiceDescription sd = messageContext.getEndpointDescription().getServiceDescription();
+                AxisConfiguration axisConfig = sd.getAxisConfigContext().getAxisConfiguration();
+                if (!axisConfig.isEngaged(Constants.MODULE_ADDRESSING))
+                    axisConfig.engageModule(Constants.MODULE_ADDRESSING);
+            }
+            catch (Exception e) {
+                //TODO NLS enable.
+                throw ExceptionFactory.makeWebServiceException("Unable to engage the addressing module.", e);
             }
         }
+
+        messageContext.setProperty(AddressingConstants.WS_ADDRESSING_VERSION, specifiedAddressingNamespace);                        
+        messageContext.setProperty(AddressingConstants.DISABLE_ADDRESSING_FOR_OUT_MESSAGES, disableAddressing);
     }
 
     /*
      *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.description.ServiceDescription)
+     * @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.description.EndpointDescription)
      */
-    public void performConfiguration(ServiceDescription serviceDescription) {
+    public void configure(EndpointDescription endpointDescription) {
         // TODO Auto-generated method stub
         
     }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/MTOMConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/MTOMConfigurator.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/MTOMConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/MTOMConfigurator.java Wed Jul  4 15:02:44 2007
@@ -1,80 +1,67 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- *      
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.jaxws.feature.config;
-
-import javax.xml.ws.Binding;
-import javax.xml.ws.soap.MTOMFeature;
-
-import org.apache.axis2.jaxws.binding.SOAPBinding;
-import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator;
-import org.apache.axis2.jaxws.message.Message;
-import org.apache.axis2.jaxws.spi.BindingProvider;
-
-/**
- *
- */
-public class MTOMConfigurator implements WebServiceFeatureConfigurator {
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
-     */
-    public void performConfiguration(MessageContext messageContext, BindingProvider provider) {
-        Binding bnd = provider.getBinding();
-        if (bnd instanceof SOAPBinding) {
-            WebServiceFeatureValidator validator = provider.getWebServiceFeatureValidator();
-            MTOMFeature mtomFeature = (MTOMFeature) validator.get(MTOMFeature.ID);
-            Message requestMsg = messageContext.getMessage();
-            
-            if (mtomFeature.isEnabled()) {
-                requestMsg.setMTOMEnabled(true);
-                
-                //TODO: Make use of the threshold somehow.
-                int threshold = mtomFeature.getThreshold();
-            }
-            
-            // If the user has enabled MTOM on the SOAPBinding, we need
-            // to make sure that gets pushed to the Message object.
-            if (((SOAPBinding)bnd).isMTOMEnabled()) {
-                requestMsg.setMTOMEnabled(true);
-            }
-
-            // Check if the user enabled MTOM using the SOAP binding 
-            // properties for MTOM
-            String bindingID = messageContext.getEndpointDescription().getClientBindingID();
-            if ((bindingID.equalsIgnoreCase(SOAPBinding.SOAP11HTTP_MTOM_BINDING) ||
-                    bindingID.equalsIgnoreCase(SOAPBinding.SOAP12HTTP_MTOM_BINDING)) &&
-                    !requestMsg.isMTOMEnabled()) {
-                requestMsg.setMTOMEnabled(true);
-            }
-        } 
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.description.ServiceDescription)
-     */
-    public void performConfiguration(ServiceDescription serviceDescription) {
-        // TODO Auto-generated method stub
-        
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.feature.config;
+
+import javax.xml.ws.soap.MTOMFeature;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.message.Message;
+import org.apache.axis2.jaxws.spi.Binding;
+import org.apache.axis2.jaxws.spi.BindingProvider;
+
+/**
+ *
+ */
+public class MTOMConfigurator implements WebServiceFeatureConfigurator {
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
+     */
+    public void configure(MessageContext messageContext, BindingProvider provider) {
+        Binding bnd = (Binding) provider.getBinding();
+        MTOMFeature mtomFeature = (MTOMFeature) bnd.getWebServiceFeature(MTOMFeature.ID);
+        Message requestMsg = messageContext.getMessage();
+        
+        if (mtomFeature == null)
+            throw ExceptionFactory.makeWebServiceException("The MTOM features was unspecified.");
+        
+        if (mtomFeature.isEnabled()) {
+            requestMsg.setMTOMEnabled(true);
+            
+            //TODO: Make use of the threshold somehow.
+            int threshold = mtomFeature.getThreshold();
+        }
+        else {
+            requestMsg.setMTOMEnabled(false);
+        }
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.description.EndpointDescription)
+     */
+    public void configure(EndpointDescription endpointDescription) {
+        // TODO Auto-generated method stub
+        
+    }    
+}

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/RespectBindingConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/RespectBindingConfigurator.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/RespectBindingConfigurator.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/feature/config/RespectBindingConfigurator.java Wed Jul  4 15:02:44 2007
@@ -1,49 +1,60 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- *      
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.axis2.jaxws.feature.config;
-
-import org.apache.axis2.jaxws.core.MessageContext;
-import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator;
-import org.apache.axis2.jaxws.spi.BindingProvider;
-
-/**
- *
- */
-public class RespectBindingConfigurator implements WebServiceFeatureConfigurator {
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
-     */
-    public void performConfiguration(MessageContext messageContext, BindingProvider provider) {
-        // TODO Auto-generated method stub
-        
-    }
-
-    /*
-     *  (non-Javadoc)
-     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.description.ServiceDescription)
-     */
-    public void performConfiguration(ServiceDescription serviceDescription) {
-        // TODO Auto-generated method stub
-        
-    }  
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.feature.config;
+
+import javax.xml.ws.RespectBindingFeature;
+
+import org.apache.axis2.jaxws.ExceptionFactory;
+import org.apache.axis2.jaxws.core.MessageContext;
+import org.apache.axis2.jaxws.description.EndpointDescription;
+import org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator;
+import org.apache.axis2.jaxws.spi.Binding;
+import org.apache.axis2.jaxws.spi.BindingProvider;
+
+/**
+ *
+ */
+public class RespectBindingConfigurator implements WebServiceFeatureConfigurator {
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator#performConfiguration(org.apache.axis2.jaxws.core.MessageContext, org.apache.axis2.jaxws.spi.BindingProvider)
+     */
+    public void configure(MessageContext messageContext, BindingProvider provider) {
+        Binding bnd = (Binding) provider.getBinding();
+        RespectBindingFeature respectBindingFeature =
+            (RespectBindingFeature) bnd.getWebServiceFeature(RespectBindingFeature.ID);
+        
+        if (respectBindingFeature == null)
+            throw ExceptionFactory.makeWebServiceException("The respect binding features was unspecified.");
+        
+        if (respectBindingFeature.isEnabled()) {
+            //TODO Implementation required.
+        }
+    }
+
+    /*
+     *  (non-Javadoc)
+     * @see org.apache.axis2.jaxws.feature.WebServiceFeatureConfigurator#configure(org.apache.axis2.jaxws.description.EndpointDescription)
+     */
+    public void configure(EndpointDescription endpointDescription) {
+        // TODO Auto-generated method stub
+        
+    }
+}

Added: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Binding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Binding.java?view=auto&rev=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Binding.java (added)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/Binding.java Wed Jul  4 15:02:44 2007
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *      
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.axis2.jaxws.spi;
+
+import javax.xml.ws.WebServiceFeature;
+
+import org.apache.axis2.jaxws.core.MessageContext;
+
+/**
+ * 
+ */
+public interface Binding extends javax.xml.ws.Binding {
+    public void setWebServiceFeatures(WebServiceFeature... features);
+    
+    public WebServiceFeature getWebServiceFeature(String id);
+    
+    public void configure(MessageContext messageContext, BindingProvider provider);
+}

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/BindingProvider.java Wed Jul  4 15:02:44 2007
@@ -18,9 +18,9 @@
  */
 package org.apache.axis2.jaxws.spi;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.feature.WebServiceFeatureValidator;
 
 /**
  * 
@@ -29,10 +29,8 @@
     public EndpointDescription getEndpointDescription();
 
     public ServiceDelegate getServiceDelegate();
-
-    public EndpointReference getAxis2EndpointReference();
     
-    public String getAddressingNamespace();
+    public EndpointReference getAxis2EndpointReference(String addressingNamespace) throws AxisFault;
     
-    public WebServiceFeatureValidator getWebServiceFeatureValidator();
+    public String getAddressingNamespace();
 }

Modified: webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=553341&r1=553340&r2=553341
==============================================================================
--- webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/branches/java/jaxws21/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Wed Jul  4 15:02:44 2007
@@ -23,7 +23,6 @@
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.java.security.AccessController;
-import org.apache.axis2.jaxws.binding.BindingImpl;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.addressing.factory.EndpointReferenceFactory;
 import org.apache.axis2.jaxws.addressing.util.EndpointReferenceConverter;
@@ -35,13 +34,7 @@
 import org.apache.axis2.jaxws.description.EndpointDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
 import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
-import org.apache.axis2.jaxws.feature.config.MTOMConfigurator;
-import org.apache.axis2.jaxws.feature.config.RespectBindingConfigurator;
-import org.apache.axis2.jaxws.feature.config.W3CAndSubmissionAddressingConfigurator;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigUtil;
-import org.apache.axis2.jaxws.feature.util.WebServiceFeatureConfigurator;
 import org.apache.axis2.jaxws.i18n.Messages;
-import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigrator;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.spi.migrator.ApplicationContextMigratorUtil;
 import org.apache.axis2.jaxws.util.WSDLWrapper;
@@ -60,8 +53,6 @@
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.Service.Mode;
 import javax.xml.ws.WebServiceException;
-import javax.xml.ws.http.HTTPBinding;
-import javax.xml.ws.soap.SOAPBinding;
 import java.lang.reflect.Proxy;
 import java.net.URL;
 import java.security.PrivilegedActionException;
@@ -74,10 +65,6 @@
  * javax.xml.ws.Service} API.  This is the plug point for the client implementation.
  */
 public class ServiceDelegate extends javax.xml.ws.spi.ServiceDelegate {
-    private static final WebServiceFeatureConfigurator[] CONFIGURATORS = {
-        new W3CAndSubmissionAddressingConfigurator(), new MTOMConfigurator(), new RespectBindingConfigurator()};
-    private static final ApplicationContextMigrator[] MIGRATORS = {new PropertyMigrator()};
-    
     private static final Log log = LogFactory.getLog(ServiceDelegate.class);
     private Executor executor;
 
@@ -109,16 +96,8 @@
         ConfigurationContext context = serviceDescription.getAxisConfigContext();
 
         // Register the necessary ApplicationContextMigrators
-        for (ApplicationContextMigrator migrator : MIGRATORS) {
-            ApplicationContextMigratorUtil.addApplicationContextMigrator(context,
-                    Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, migrator);
-        }
-        
-        // Register our WebServiceFeature configurators.
-//        for (WebServiceFeatureConfigurator configurator : CONFIGURATORS) {
-//            WebServiceFeatureConfigUtil.addWebServiceFeatureConfigurator(context,
-//                    Constants.WEB_SERVICE_FEATURE_CONFIGURATOR_LIST_ID, configurator);            
-//        }
+        ApplicationContextMigratorUtil.addApplicationContextMigrator(context,
+                Constants.APPLICATION_CONTEXT_MIGRATOR_LIST_ID, new PropertyMigrator());
     }
 
     //================================================
@@ -195,9 +174,6 @@
 
         XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc, axis2EPR, addressingNamespace, features);
 
-        // FIXME: This call needs to be revisited.  Not really sure what we're trying to do here.
-        dispatch.setBinding(addBinding(endpointDesc, endpointDesc.getClientBindingID()));
-
         if (mode != null) {
             dispatch.setMode(mode);
         } else {
@@ -241,7 +217,6 @@
         }
 
         JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc, axis2EPR, addressingNamespace, features);
-        dispatch.setBinding(addBinding(endpointDesc, endpointDesc.getClientBindingID()));
 
         if (mode != null) {
             dispatch.setMode(mode);
@@ -279,8 +254,6 @@
 
         XMLDispatch<T> dispatch = new XMLDispatch<T>(this, endpointDesc, features);
 
-        // FIXME: This call needs to be revisited.  Not really sure what we're trying to do here. 
-        dispatch.setBinding(addBinding(endpointDesc, endpointDesc.getClientBindingID()));
         if (mode != null) {
             dispatch.setMode(mode);
         } else {
@@ -311,7 +284,6 @@
         }
 
         JAXBDispatch<Object> dispatch = new JAXBDispatch(this, endpointDesc, features);
-        dispatch.setBinding(addBinding(endpointDesc, endpointDesc.getClientBindingID()));
 
         if (mode != null) {
             dispatch.setMode(mode);
@@ -593,28 +565,6 @@
 
     private boolean isServiceDefined(QName serviceName) {
         return getWSDLWrapper().getService(serviceName) != null;
-    }
-
-    private BindingImpl addBinding(EndpointDescription endpointDesc, String bindingId) {
-        // TODO: before creating binding do I have to do something with Handlers ... how is Binding related to Handler, this mistry sucks!!!
-        if (bindingId != null) {
-            //TODO: create all the bindings here
-            if (bindingId.equals(SOAPBinding.SOAP11HTTP_BINDING)) {
-                //instantiate soap11 binding implementation here and call setBinding in BindingProvider
-                return new org.apache.axis2.jaxws.binding.SOAPBinding(endpointDesc);
-            }
-
-            if (bindingId.equals(SOAPBinding.SOAP12HTTP_BINDING)) {
-                //instantiate soap11 binding implementation here and call setBinding in BindingProvider
-                return new org.apache.axis2.jaxws.binding.SOAPBinding(endpointDesc);
-            }
-
-            if (bindingId.equals(HTTPBinding.HTTP_BINDING)) {
-                //instantiate http binding implementation here and call setBinding in BindingProvider
-                return new org.apache.axis2.jaxws.binding.HTTPBinding(endpointDesc);
-            }
-        } 
-        return new org.apache.axis2.jaxws.binding.SOAPBinding(endpointDesc);
     }
 
     private boolean isValidDispatchType(Class clazz) {



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org