cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dand...@apache.org
Subject svn commit: r529436 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/binding/ api/src/main/java/org/apache/cxf/endpoint/ api/src/main/java/org/apache/cxf/interceptor/ api/src/main/java/org/apache/cxf/phase/ api/src/main/java/org/apache...
Date Mon, 16 Apr 2007 23:01:54 GMT
Author: dandiep
Date: Mon Apr 16 16:01:51 2007
New Revision: 529436

URL: http://svn.apache.org/viewvc?view=rev&rev=529436
Log:
o Add support for resolving an Endpoint after the chain has be initiated.
  This comes through a new MutlipleEndpointObserver. If multiple a user
  attempts to register multiple endpoints on the same address, this observer
  will be created. Various binding interceptors and routing interceptors
  will be added to it.

  The BindingFactoryManager is now in control of creating the MessageObserver.
  this allows it to add in various binding interceptors (like ReadHeadersInterceptor)
  and then create interceptors specifically oriented around selecting the
  correct endpoint. The SOAP binding contains a simple EndpointSelectionInterceptor
  which resolves the most appropriate binding based on the SOAP version used.
o Changed the ResourceInjector to search through parent classes as well
  so injenction on AbstractBindingFactory works correctly
o Updated the versioning systest to use this improved method
 

Added:
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java   (with props)
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java   (with props)
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml   (with props)
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingFactory.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/AbstractAttributedInterceptorProvider.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Interceptor.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InterceptorChain.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
    incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/Messages.properties
    incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/mtom/MtomTest.java
    incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
    incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
    incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
    incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingTest.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
    incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/holder/HolderTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java
    incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/Server.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/Server.java

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/Binding.java Mon Apr 16 16:01:51 2007
@@ -21,6 +21,7 @@
 
 import org.apache.cxf.interceptor.InterceptorProvider;
 import org.apache.cxf.message.Message;
+import org.apache.cxf.service.model.BindingInfo;
 
 /**
  * A Binding provides interceptors and message creation logic for a 
@@ -31,4 +32,6 @@
     Message createMessage();
 
     Message createMessage(Message m);
+    
+    BindingInfo getBindingInfo();
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingFactory.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/binding/BindingFactory.java Mon Apr 16 16:01:51 2007
@@ -19,8 +19,10 @@
 
 package org.apache.cxf.binding;
 
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.transport.Destination;
 
 /**
  * A factory interface for creating Bindings from BindingInfo metadata.
@@ -42,4 +44,6 @@
      * @return
      */
     BindingInfo createBindingInfo(Service service, String namespace, Object configObject);
+    
+    void addListener(Destination d, Endpoint e);
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/endpoint/Server.java Mon Apr 16 16:01:51 2007
@@ -20,7 +20,6 @@
 package org.apache.cxf.endpoint;
 
 import org.apache.cxf.transport.Destination;
-import org.apache.cxf.transport.MessageObserver;
 
 public interface Server  {
 
@@ -31,7 +30,4 @@
     Destination getDestination();
     
     Endpoint getEndpoint();
-    
-    MessageObserver getMessageObserver();
-        
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/AbstractAttributedInterceptorProvider.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/AbstractAttributedInterceptorProvider.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/AbstractAttributedInterceptorProvider.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/AbstractAttributedInterceptorProvider.java Mon Apr 16 16:01:51 2007
@@ -62,6 +62,16 @@
     public void setOutFaultInterceptors(List<Interceptor> interceptors) {
         outFault = interceptors;
     }
+
+    @Override
+    public boolean equals(Object o) {
+        return o == this;
+    }
+
+    @Override
+    public int hashCode() {
+        return super.hashCode();
+    }
     
     
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Interceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Interceptor.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Interceptor.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/Interceptor.java Mon Apr 16 16:01:51 2007
@@ -40,11 +40,5 @@
      * @param message
      */
     void handleFault(T message);
-    
-    /**
-     * Clean up interceptor.
-     * @param message
-     * @throws Fault
-     */
-    void postHandleMessage(T message) throws Fault;
+
 }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InterceptorChain.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/interceptor/InterceptorChain.java Mon Apr 16 16:01:51 2007
@@ -19,6 +19,7 @@
 
 package org.apache.cxf.interceptor;
 
+import java.util.Collection;
 import java.util.ListIterator;
 
 import org.apache.cxf.message.Message;
@@ -36,6 +37,8 @@
     String STARTING_AFTER_INTERCEPTOR_ID = "starting_after_interceptor_id";
     
     void add(Interceptor i);
+    
+    void add(Collection<Interceptor> i);
     
     void remove(Interceptor i);
     

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/AbstractPhaseInterceptor.java Mon Apr 16 16:01:51 2007
@@ -24,7 +24,6 @@
 
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.message.Message;
 
 public abstract class AbstractPhaseInterceptor<T extends Message> implements PhaseInterceptor<T> {
@@ -86,11 +85,7 @@
 
     public void handleFault(T message) {
     }
-    
-    public void postHandleMessage(T message) throws Fault {
-        
-    }
-    
+
     public boolean isGET(T message) {
         String method = (String)message.get(Message.HTTP_REQUEST_METHOD);
         return "GET".equals(method) && message.getContent(XMLStreamReader.class) == null;

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/phase/PhaseInterceptorChain.java Mon Apr 16 16:01:51 2007
@@ -80,11 +80,11 @@
         iterator = new PhaseInterceptorIterator();
     }
     
-    public void add(List<Interceptor> newhandlers) {
+    public void add(Collection<Interceptor> newhandlers) {
         add(newhandlers, false);
     }
 
-    public void add(List<Interceptor> newhandlers, boolean force) {
+    public void add(Collection<Interceptor> newhandlers, boolean force) {
         if (newhandlers == null) {
             return;
         }

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/Destination.java Mon Apr 16 16:01:51 2007
@@ -21,7 +21,6 @@
 
 import java.io.IOException;
 
-
 import org.apache.cxf.message.Message;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 
@@ -58,4 +57,6 @@
      * Shutdown the Destination, i.e. stop accepting incoming messages.
      */
     void shutdown();
+    
+    MessageObserver getMessageObserver();
 }

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/AnnotationProcessor.java Mon Apr 16 16:01:51 2007
@@ -92,7 +92,7 @@
     
     private void processMethods(AnnotationVisitor visitor) {
         
-        visitAnnotatedElement(target.getClass().getDeclaredMethods(), visitor, visitMethodMethod); 
+        visitAnnotatedElement(target.getClass().getMethods(), visitor, visitMethodMethod); 
     }
     
     private void processFields(AnnotationVisitor visitor) { 
@@ -120,7 +120,7 @@
                         // ignore, we're invoking methods of a public interface
                     } catch (InvocationTargetException e) {
                         Throwable cause = e.getCause() == null ? e : e.getCause();
-                        LogUtils.log(LOG, Level.SEVERE, "VISITOR_RAISED_EXCEPTION", cause, visitor);
+                        LogUtils.log(LOG, Level.SEVERE, "VISITOR_RAISED_EXCEPTION", cause, visitor, element);
                     }
                 }
             }

Modified: incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/Messages.properties?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/Messages.properties (original)
+++ incubator/cxf/trunk/common/common/src/main/java/org/apache/cxf/common/annotation/Messages.properties Mon Apr 16 16:01:51 2007
@@ -19,4 +19,4 @@
 #
 #
 INVALID_CTOR_ARGS=Either a non-null object or non-null class must be specified.
-VISITOR_RAISED_EXCEPTION=an AnnotationVisitor ({0})raised an exception.
+VISITOR_RAISED_EXCEPTION=an AnnotationVisitor ({0}) raised an exception on element {1}.

Modified: incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/main/java/org/apache/cxf/binding/http/HttpBindingFactory.java Mon Apr 16 16:01:51 2007
@@ -20,10 +20,8 @@
 
 import java.lang.reflect.Method;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
-import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.binding.AbstractBindingFactory;
@@ -50,25 +48,15 @@
 public class HttpBindingFactory extends AbstractBindingFactory {
 
     public static final String HTTP_BINDING_ID = "http://apache.org/cxf/binding/http";
-    private Collection<String> activationNamespaces;
     private List<ResourceStrategy> strategies = new ArrayList<ResourceStrategy>();
 
     public HttpBindingFactory() {
         strategies.add(new JRAStrategy());
         strategies.add(new ConventionStrategy());
     }
-    
-    @Resource(name = "activationNamespaces")
-    public void setActivationNamespaces(Collection<String> ans) {
-        activationNamespaces = ans;
-    }
-    
-    public Collection<String> getActivationNamespaces() {
-        return activationNamespaces;
-    }
 
     public Binding createBinding(BindingInfo bi) {
-        XMLBinding binding = new XMLBinding();
+        XMLBinding binding = new XMLBinding(bi);
         
         binding.getInInterceptors().add(new AttachmentInInterceptor());
         binding.getInInterceptors().add(new DatabindingInSetupInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/bare/BareServiceTest.java Mon Apr 16 16:01:51 2007
@@ -40,6 +40,7 @@
     public void testCreation() throws Exception {
         BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
         HttpBindingFactory factory = new HttpBindingFactory();
+        factory.setBus(getBus());
         bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, factory);
         
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
@@ -123,6 +124,7 @@
     public void testSetContentType() throws Exception {
         BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
         HttpBindingFactory factory = new HttpBindingFactory();
+        factory.setBus(getBus());
         bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, factory);
         
         JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();

Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/mtom/MtomTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/mtom/MtomTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/mtom/MtomTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/mtom/MtomTest.java Mon Apr 16 16:01:51 2007
@@ -39,6 +39,7 @@
     public void testService() throws Exception {
         BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
         HttpBindingFactory factory = new HttpBindingFactory();
+        factory.setBus(getBus());
         bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, factory);
 
         PeopleServiceImpl impl = new PeopleServiceImpl();

Modified: incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/http/src/test/java/org/apache/cxf/binding/http/wrapped/WrappedServiceTest.java Mon Apr 16 16:01:51 2007
@@ -50,6 +50,7 @@
     }
 
     public void testService(HttpBindingFactory httpFactory) throws Exception {
+        httpFactory.setBus(bus);
         BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
         bfm.registerBindingFactory(HttpBindingFactory.HTTP_BINDING_ID, httpFactory);
         

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBinding.java Mon Apr 16 16:01:51 2007
@@ -22,11 +22,23 @@
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingInfo;
 
 public class ObjectBinding extends AbstractBasicInterceptorProvider implements Binding {
 
     public static final String OPERATION = "objectBinding.operationName";
     public static final String BINDING = "objectBinding.bindingName";
+    
+    private BindingInfo bindingInfo;
+    
+    public ObjectBinding(BindingInfo bindingInfo) {
+        super();
+        this.bindingInfo = bindingInfo;
+    }
+
+    public BindingInfo getBindingInfo() {
+        return bindingInfo;
+    }
 
     public Message createMessage() {
         return new MessageImpl();

Modified: incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/object/src/main/java/org/apache/cxf/binding/object/ObjectBindingFactory.java Mon Apr 16 16:01:51 2007
@@ -18,10 +18,7 @@
  */
 package org.apache.cxf.binding.object;
 
-import java.util.Collection;
-
 import javax.annotation.PostConstruct;
-import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
@@ -37,29 +34,14 @@
     public static final String BINDING_ID = "http://cxf.apache.org/binding/object";
     public static final String RUN_NON_LOGICAL  = "objectBinding.stopAfterLogical";
     
-    private Collection<String> activationNamespaces;    
-    private Bus bus;
     private boolean autoRegisterLocalEndpoint;
     private boolean initialized = true;
     private LocalServerListener listener;
     
-    public Collection<String> getActivationNamespaces() {
-        return activationNamespaces;
-    }
-
-    @Resource(name = "activationNamespaces")
-    public void setActivationNamespaces(Collection<String> ans) {
-        activationNamespaces = ans;
-    }
-    
-    @Resource(name = "bus")
-    public void setBus(Bus bus) {
-        this.bus = bus;
-    }
-
     @PostConstruct
     public void initialize() {
         if (autoRegisterLocalEndpoint) {
+            Bus bus = getBus();
             ServerLifeCycleManager manager = bus.getExtension(ServerLifeCycleManager.class);
             if (manager != null) {
                 listener = new LocalServerListener(bus, this);
@@ -70,7 +52,7 @@
     }
     
     public Binding createBinding(BindingInfo bi) {
-        ObjectBinding binding = new ObjectBinding();
+        ObjectBinding binding = new ObjectBinding(bi);
         binding.getOutInterceptors().add(new ObjectDispatchOutInterceptor());
         binding.getInInterceptors().add(new ObjectDispatchInInterceptor());
         

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBinding.java Mon Apr 16 16:01:51 2007
@@ -23,19 +23,26 @@
 import org.apache.cxf.interceptor.AbstractBasicInterceptorProvider;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.service.model.BindingInfo;
 
 public class SoapBinding extends AbstractBasicInterceptorProvider implements Binding {
     
     private SoapVersion version;
+    private BindingInfo bindingInfo;
     
-    public SoapBinding() {
-        this(Soap11.getInstance());
+    public SoapBinding(BindingInfo info) {
+        this(info, Soap11.getInstance());
     }
     
-    public SoapBinding(SoapVersion v) {
+    public SoapBinding(BindingInfo info, SoapVersion v) {
         version = v; 
+        bindingInfo = info;
     }
     
+    public BindingInfo getBindingInfo() {
+        return bindingInfo;
+    }
+
     public void setSoapVersion(SoapVersion v) {
         this.version = v;
     }

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/SoapBindingFactory.java Mon Apr 16 16:01:51 2007
@@ -20,11 +20,9 @@
 package org.apache.cxf.binding.soap;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 
-import javax.annotation.Resource;
 import javax.wsdl.extensions.ExtensibilityElement;
 import javax.wsdl.extensions.mime.MIMEContent;
 import javax.wsdl.extensions.mime.MIMEMultipartRelated;
@@ -33,6 +31,7 @@
 
 import org.apache.cxf.binding.AbstractBindingFactory;
 import org.apache.cxf.binding.Binding;
+import org.apache.cxf.binding.soap.interceptor.EndpointSelectionInterceptor;
 import org.apache.cxf.binding.soap.interceptor.MustUnderstandInterceptor;
 import org.apache.cxf.binding.soap.interceptor.RPCInInterceptor;
 import org.apache.cxf.binding.soap.interceptor.RPCOutInterceptor;
@@ -50,6 +49,7 @@
 import org.apache.cxf.binding.soap.model.SoapHeaderInfo;
 import org.apache.cxf.binding.soap.model.SoapOperationInfo;
 import org.apache.cxf.common.util.StringUtils;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.interceptor.AttachmentInInterceptor;
 import org.apache.cxf.interceptor.AttachmentOutInterceptor;
 import org.apache.cxf.interceptor.BareOutInterceptor;
@@ -70,6 +70,10 @@
 import org.apache.cxf.tools.common.extensions.soap.SoapHeader;
 import org.apache.cxf.tools.common.extensions.soap.SoapOperation;
 import org.apache.cxf.tools.util.SOAPBindingUtil;
+import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MultipleEndpointObserver;
 
 
 public class SoapBindingFactory extends AbstractBindingFactory {
@@ -78,17 +82,6 @@
     
     private boolean mtomEnabled = true;
     
-    private Collection<String> activationNamespaces;    
-
-    public Collection<String> getActivationNamespaces() {
-        return activationNamespaces;
-    }
-
-    @Resource(name = "activationNamespaces")
-    public void setActivationNamespaces(Collection<String> ans) {
-        activationNamespaces = ans;
-    }
-
     public BindingInfo createBindingInfo(ServiceInfo si, String bindingid, Object conf) {
         SoapBindingConfiguration config;
         if (conf instanceof SoapBindingConfiguration) {
@@ -184,7 +177,7 @@
         if (binding instanceof SoapBindingInfo) {
             SoapBindingInfo sbi = (SoapBindingInfo) binding;
             version = sbi.getSoapVersion();
-            sb = new SoapBinding(version);
+            sb = new SoapBinding(binding, version);
             // Service wide style
             if (!StringUtils.isEmpty(sbi.getStyle())) {
                 bindingStyle = sbi.getStyle();
@@ -373,6 +366,47 @@
         bmsg.addExtensor(bodyInfo);
     }
     
+    @Override
+    public synchronized void addListener(Destination d, Endpoint e) {
+        MessageObserver mo = d.getMessageObserver();
+        if (mo == null) {
+            super.addListener(d, e);
+            return;
+        } 
+        
+        if (mo instanceof ChainInitiationObserver) {
+            ChainInitiationObserver cio = (ChainInitiationObserver) mo;
+            MultipleEndpointObserver newMO = new MultipleEndpointObserver(getBus()) {
+                @Override
+                protected Message createMessage(Message message) {
+                    return new SoapMessage(message);
+                }
+            };
+            
+            newMO.getBindingInterceptors().add(new AttachmentInInterceptor());
+            newMO.getBindingInterceptors().add(new StaxInInterceptor()); 
+            
+            // This will not work if we one of the endpoints disables message
+            // processing. But, if you've disabled message processing, you 
+            // probably aren't going to use this feature.
+            newMO.getBindingInterceptors().add(new ReadHeadersInterceptor());
+
+            // Add in a default selection interceptor
+            newMO.getRoutingInterceptors().add(new EndpointSelectionInterceptor());
+            
+            newMO.getEndpoints().add(cio.getEndpoint());
+            
+            mo = newMO;
+        }
+        
+        if (mo instanceof MultipleEndpointObserver) {
+            MultipleEndpointObserver meo = (MultipleEndpointObserver) mo;
+            meo.getEndpoints().add(e);
+        }
+        
+        d.setMessageObserver(mo);
+    }
+
     public void setMtomEnabled(boolean mtomEnabled) {
         this.mtomEnabled = mtomEnabled;
     }

Added: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java (added)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java Mon Apr 16 16:01:51 2007
@@ -0,0 +1,64 @@
+/**
+ * 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.cxf.binding.soap.interceptor;
+
+import java.util.Set;
+
+import org.apache.cxf.binding.soap.SoapMessage;
+import org.apache.cxf.binding.soap.SoapVersion;
+import org.apache.cxf.binding.soap.model.SoapBindingInfo;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.AbstractEndpointSelectionInterceptor;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.model.BindingInfo;
+import org.apache.cxf.service.model.EndpointInfo;
+
+/**
+ * Selects the most appropriate endpoint based on the SOAP version used.
+ * 
+ * @param message
+ * @param eps
+ * @return
+ */
+public class EndpointSelectionInterceptor extends AbstractEndpointSelectionInterceptor {
+    
+    public EndpointSelectionInterceptor() {
+        super();
+        setPhase(Phase.READ);
+        getAfter().add(ReadHeadersInterceptor.class.getName());
+    }
+
+    protected Endpoint selectEndpoint(Message message, Set<Endpoint> eps) {
+        SoapVersion sv = ((SoapMessage)message).getVersion();
+
+        for (Endpoint e : eps) {
+            EndpointInfo ei = e.getEndpointInfo();
+            BindingInfo binding = ei.getBinding();
+
+            if (binding instanceof SoapBindingInfo 
+                && ((SoapBindingInfo)binding).getSoapVersion().equals(sv)) {
+                return e;
+            }
+        }
+
+        return null;
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/bindings/soap/src/main/java/org/apache/cxf/binding/soap/interceptor/EndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/main/resources/META-INF/cxf/cxf-extension-soap.xml Mon Apr 16 16:01:51 2007
@@ -32,6 +32,7 @@
                 <value>http://schemas.xmlsoap.org/wsdl/soap12/</value>
             </set>
         </property>
+        <property name="bus" ref="cxf"/>
     </bean>
     
     <bean class="org.apache.cxf.binding.soap.SoapTransportFactory" lazy-init="true">

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapActionInterceptorTest.java Mon Apr 16 16:01:51 2007
@@ -36,7 +36,7 @@
         Message message = new MessageImpl();
         message.setExchange(new ExchangeImpl());
         message.getExchange().setOutMessage(message);
-        SoapBinding sb = new SoapBinding();
+        SoapBinding sb = new SoapBinding(null);
         message = sb.createMessage(message);
         assertNotNull(message);
         assertTrue(message instanceof SoapMessage);

Modified: incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingTest.java (original)
+++ incubator/cxf/trunk/rt/bindings/soap/src/test/java/org/apache/cxf/binding/soap/SoapBindingTest.java Mon Apr 16 16:01:51 2007
@@ -28,7 +28,7 @@
     
     public void testCreateMessage() throws Exception {
         Message message = new MessageImpl();
-        SoapBinding sb = new SoapBinding();
+        SoapBinding sb = new SoapBinding(null);
         message = sb.createMessage(message);
         assertNotNull(message);
         assertTrue(message instanceof SoapMessage);

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBinding.java Mon Apr 16 16:01:51 2007
@@ -23,12 +23,21 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.message.XMLMessage;
+import org.apache.cxf.service.model.BindingInfo;
 
 public class XMLBinding extends AbstractBasicInterceptorProvider implements Binding {
+    
+    private BindingInfo bindingInfo;
+    
+    public XMLBinding(BindingInfo bindingInfo) {
+        super();
+        this.bindingInfo = bindingInfo;
+    }
 
-    public XMLBinding() {
+    public BindingInfo getBindingInfo() {
+        return bindingInfo;
     }
-    
+
     public Message createMessage() {
         return createMessage(new MessageImpl());
     }

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/java/org/apache/cxf/binding/xml/XMLBindingFactory.java Mon Apr 16 16:01:51 2007
@@ -18,9 +18,6 @@
  */
 package org.apache.cxf.binding.xml;
 
-import java.util.Collection;
-
-import javax.annotation.Resource;
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.binding.AbstractBindingFactory;
@@ -41,19 +38,8 @@
 
 public class XMLBindingFactory extends AbstractBindingFactory {
 
-    private Collection<String> activationNamespaces;
-
-    @Resource(name = "activationNamespaces")
-    public void setActivationNamespaces(Collection<String> ans) {
-        activationNamespaces = ans;
-    }
-
-    public Collection<String> getActivationNamespaces() {
-        return activationNamespaces;
-    }
-
     public Binding createBinding(BindingInfo binding) {
-        XMLBinding xb = new XMLBinding();
+        XMLBinding xb = new XMLBinding(binding);
         
         xb.getInInterceptors().add(new AttachmentInInterceptor());
         xb.getInInterceptors().add(new StaxInInterceptor());

Modified: incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml (original)
+++ incubator/cxf/trunk/rt/bindings/xml/src/main/resources/META-INF/cxf/cxf-extension-xml.xml Mon Apr 16 16:01:51 2007
@@ -30,6 +30,7 @@
                 <value>http://www.w3.org/2004/08/wsdl/http</value>
             </set>
         </property>
+        <property name="bus" ref="cxf"/>
     </bean>
     
 </beans>

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/binding/AbstractBindingFactory.java Mon Apr 16 16:01:51 2007
@@ -31,11 +31,14 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
 import org.apache.cxf.service.Service;
 import org.apache.cxf.service.model.AbstractPropertiesHolder;
 import org.apache.cxf.service.model.BindingInfo;
 import org.apache.cxf.service.model.BindingOperationInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.ChainInitiationObserver;
+import org.apache.cxf.transport.Destination;
 import org.apache.cxf.wsdl11.WSDLBindingFactory;
 
 import static org.apache.cxf.helpers.CastUtils.cast;
@@ -44,12 +47,10 @@
 
     public static final String DATABINDING_DISABLED = "databinding.disabled";
     
-    @Resource
-    Bus bus;
-    
-    @Resource
     Collection<String> activationNamespaces;
     
+    Bus bus;
+
     @PostConstruct
     void registerWithBindingManager() {
         BindingFactoryManager manager = bus.getExtension(BindingFactoryManager.class);
@@ -144,4 +145,29 @@
             }
         }
     }
+
+    public void addListener(Destination d, Endpoint e) {
+        ChainInitiationObserver observer = new ChainInitiationObserver(e, bus);
+        
+        d.setMessageObserver(observer);
+    }
+
+    public Bus getBus() {
+        return bus;
+    }
+
+    @Resource(name = "bus")
+    public void setBus(Bus bus) {
+        this.bus = bus;
+    }
+
+    public Collection<String> getActivationNamespaces() {
+        return activationNamespaces;
+    }
+
+    @Resource(name = "activationNamespaces")
+    public void setActivationNamespaces(Collection<String> activationNamespaces) {
+        this.activationNamespaces = activationNamespaces;
+    }
+    
 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/endpoint/ServerImpl.java Mon Apr 16 16:01:51 2007
@@ -27,6 +27,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.BusException;
+import org.apache.cxf.binding.BindingFactory;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.management.InstrumentationManager;
 import org.apache.cxf.service.model.EndpointInfo;
@@ -34,29 +35,25 @@
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MultipleEndpointObserver;
 
 public class ServerImpl implements Server {
     private static final Logger LOG = LogUtils.getL7dLogger(ServerImpl.class);    
     private Destination destination;
-    private MessageObserver messageObserver;
     private Endpoint endpoint;
     private ServerRegistry serverRegistry;
     private Bus bus;
     private ServerLifeCycleManager mgr;
-    
-    public ServerImpl(Bus bus, Endpoint endpoint, MessageObserver observer) 
-        throws BusException, IOException {
-        this(bus, endpoint, null, observer);
-    }
+    private BindingFactory bindingFactory;
     
     public ServerImpl(Bus bus, 
                       Endpoint endpoint, 
                       DestinationFactory destinationFactory, 
-                      MessageObserver observer) throws BusException, IOException {
+                      BindingFactory bindingFactory) throws BusException, IOException {
         this.endpoint = endpoint;
-        this.messageObserver = observer;  
         this.bus = bus;
-
+        this.bindingFactory = bindingFactory;
+        
         EndpointInfo ei = endpoint.getEndpointInfo();
         
         //Treat local transport as a special case, transports loaded by transportId can be replaced
@@ -100,8 +97,8 @@
     }
 
     public void start() {     
+        bindingFactory.addListener(destination, endpoint);
         
-        getDestination().setMessageObserver(messageObserver);
         // register the active server to run
         if (null != serverRegistry) {
             LOG.fine("register the server to serverRegistry ");
@@ -118,24 +115,22 @@
         if (mgr != null) {
             mgr.stopServer(this);
         }
-        getDestination().setMessageObserver(null);
+        
+        MessageObserver mo = getDestination().getMessageObserver();
+        if (mo instanceof MultipleEndpointObserver) {
+            ((MultipleEndpointObserver) mo).getEndpoints().remove(endpoint);
+        } else {
+            getDestination().setMessageObserver(null);
+        }
+        
         if (null != serverRegistry) {
             LOG.fine("unregister the server to serverRegistry ");
             serverRegistry.unregister(this);
         }
     }
 
-    public MessageObserver getMessageObserver() {
-        return messageObserver;
-    }
-
-    public void setMessageObserver(MessageObserver messageObserver) {
-        this.messageObserver = messageObserver;
-    }
-
     public Endpoint getEndpoint() {
         return endpoint;
     }
-    
     
 }

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java Mon Apr 16 16:01:51 2007
@@ -0,0 +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.cxf.interceptor;
+
+import java.util.Set;
+
+import org.apache.cxf.binding.Binding;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.helpers.CastUtils;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.service.Service;
+import org.apache.cxf.transport.MultipleEndpointObserver;
+
+public abstract class AbstractEndpointSelectionInterceptor extends AbstractPhaseInterceptor<Message> {
+    
+    public AbstractEndpointSelectionInterceptor() {
+        super();
+        
+    }
+
+    public void handleMessage(Message message) throws Fault {
+        Exchange ex = message.getExchange();
+        Set<Endpoint> endpoints = CastUtils.cast((Set)ex.get(MultipleEndpointObserver.ENDPOINTS));
+
+        Endpoint ep = selectEndpoint(message, endpoints);
+
+        if (ep == null) {
+            return;
+        }
+
+        ex.put(Endpoint.class, ep);
+        ex.put(Binding.class, ep.getBinding());
+        ex.put(Service.class, ep.getService());
+
+        InterceptorChain chain = message.getInterceptorChain();
+        chain.add(ep.getInInterceptors());
+        chain.add(ep.getBinding().getInInterceptors());
+        chain.add(ep.getService().getInInterceptors());
+    }
+
+    /**
+     * Select an Endpoint which will be used for the rest of the inocation.
+     * 
+     * @param message
+     * @param eps
+     * @return
+     */
+    protected abstract Endpoint selectEndpoint(Message message, Set<Endpoint> eps);
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/AbstractEndpointSelectionInterceptor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/interceptor/DocLiteralInInterceptor.java Mon Apr 16 16:01:51 2007
@@ -116,7 +116,7 @@
                 }
 
                 // loop through each child element
-                while (StaxUtils.toNextElement(xmlReader)) {
+                while (StaxUtils.toNextElement(xmlReader) && itr.hasNext()) {
                     MessagePartInfo part = itr.next();
                     parameters.add(dr.read(part, xmlReader));
                 }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractTransportFactory.java Mon Apr 16 16:01:51 2007
@@ -22,8 +22,6 @@
 import java.util.List;
 import java.util.Set;
 
-import javax.annotation.Resource;
-
 import org.apache.cxf.helpers.CastUtils;
 
 /**
@@ -36,7 +34,6 @@
         return transportIds;
     }
 
-    @Resource
     public void setTransportIds(List<String> transportIds) {
         this.transportIds = transportIds;
     }

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/ChainInitiationObserver.java Mon Apr 16 16:01:51 2007
@@ -82,5 +82,9 @@
             exchange.setDestination(m.getDestination());
         }
     }
+
+    public Endpoint getEndpoint() {
+        return endpoint;
+    }
     
 }

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java Mon Apr 16 16:01:51 2007
@@ -0,0 +1,129 @@
+/**
+ * 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.cxf.transport;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.Interceptor;
+import org.apache.cxf.message.Exchange;
+import org.apache.cxf.message.ExchangeImpl;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.phase.PhaseManager;
+
+/**
+ * This MessageObserver creates an Interceptor chain which adds in the interceptors
+ * set on this class and the global Bus interceptors. At somepoint, it is expected
+ * that these interceptors will resolve the appropriate Endpoint/Binding combination
+ * and continue setting up the chain.
+ *
+ */
+public class MultipleEndpointObserver implements MessageObserver {
+    
+    public static final String ENDPOINTS = "multipleEndpointObserver.endpoints";
+    
+    protected Bus bus;
+    protected List<Interceptor> bindingInterceptors = new ArrayList<Interceptor>();
+    protected List<Interceptor> routingInterceptors = new ArrayList<Interceptor>();
+    private Set<Endpoint> endpoints = new HashSet<Endpoint>();
+    
+    public MultipleEndpointObserver(Bus bus) {
+        super();
+        this.bus = bus;
+    }
+
+    public void onMessage(Message message) {
+        message = createMessage(message);
+        Exchange exchange = message.getExchange();
+        if (exchange == null) {
+            exchange = new ExchangeImpl();
+            exchange.setInMessage(message);
+        }
+        setExchangeProperties(exchange, message);
+        
+        // setup chain
+        PhaseInterceptorChain chain = createChain();
+        
+        message.setInterceptorChain(chain);
+        
+        chain.add(bus.getInInterceptors());
+        if (bindingInterceptors != null) {
+            chain.add(bindingInterceptors);
+        }
+        if (routingInterceptors != null) {
+            chain.add(routingInterceptors);
+        }
+        
+        if (endpoints != null) {
+            exchange.put(ENDPOINTS, endpoints);
+        }
+        
+        chain.doIntercept(message);        
+    }
+
+    /**
+     * Give a chance for a Binding to customize their message
+     */
+    protected Message createMessage(Message message) {
+        return message;
+    }
+
+    protected PhaseInterceptorChain createChain() {
+        PhaseInterceptorChain chain = new PhaseInterceptorChain(bus.getExtension(PhaseManager.class)
+            .getInPhases());
+        return chain;
+    }
+    
+    protected void setExchangeProperties(Exchange exchange, Message m) {
+        exchange.put(Bus.class, bus);
+        if (exchange.getDestination() == null) {
+            exchange.setDestination(m.getDestination());
+        }
+    }
+
+    public List<Interceptor> getBindingInterceptors() {
+        return bindingInterceptors;
+    }
+
+    public void setBindingInterceptors(List<Interceptor> bindingInterceptors) {
+        this.bindingInterceptors = bindingInterceptors;
+    }
+
+    public List<Interceptor> getRoutingInterceptors() {
+        return routingInterceptors;
+    }
+
+    public void setRoutingInterceptors(List<Interceptor> routingInterceptors) {
+        this.routingInterceptors = routingInterceptors;
+    }
+
+    public Set<Endpoint> getEndpoints() {
+        return endpoints;
+    }
+
+    public void setEndpoints(Set<Endpoint> endpoints) {
+        this.endpoints = endpoints;
+    }
+    
+}

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/MultipleEndpointObserver.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/AbstractJaxWsTest.java Mon Apr 16 16:01:51 2007
@@ -42,7 +42,7 @@
         super.setUpBus();
         
         SoapBindingFactory bindingFactory = new SoapBindingFactory();
-
+        bindingFactory.setBus(bus);
         bus.getExtension(BindingFactoryManager.class)
             .registerBindingFactory("http://schemas.xmlsoap.org/wsdl/soap/", bindingFactory);
         bus.getExtension(BindingFactoryManager.class)

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/holder/HolderTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/holder/HolderTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/holder/HolderTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/holder/HolderTest.java Mon Apr 16 16:01:51 2007
@@ -39,7 +39,6 @@
 
     @Override
     protected Bus createBus() throws BusException {
-        // TODO Auto-generated method stub
         return new CXFBusFactory().createBus();
     }
 

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java Mon Apr 16 16:01:51 2007
@@ -28,6 +28,7 @@
 import org.apache.cxf.BusException;
 import org.apache.cxf.BusFactory;
 import org.apache.cxf.binding.BindingConfiguration;
+import org.apache.cxf.binding.BindingFactory;
 import org.apache.cxf.binding.BindingFactoryManager;
 import org.apache.cxf.binding.soap.SoapBindingConfiguration;
 import org.apache.cxf.binding.soap.model.SoapBindingInfo;
@@ -57,6 +58,7 @@
     private String transportId;
     private String bindingId;
     private Class serviceClass;
+    private BindingFactory bindingFactory;
     private DestinationFactory destinationFactory;
     private ReflectionServiceFactoryBean serviceFactory;
     private QName endpointName;
@@ -80,10 +82,14 @@
             endpointName = serviceFactory.getEndpointName();
         }
         EndpointInfo ei = service.getEndpointInfo(endpointName);
-        if (ei != null
-            && transportId != null
-            && !ei.getTransportId().equals(transportId)) {
-            ei = null;
+        if (ei != null) {
+            if (transportId != null
+                && !ei.getTransportId().equals(transportId)) {
+                ei = null;
+            } else {
+                BindingFactoryManager bfm = getBus().getExtension(BindingFactoryManager.class);
+                bindingFactory = bfm.getBindingFactory(ei.getBinding().getBindingId());
+            }
         }
         
         if (ei == null) {
@@ -225,9 +231,14 @@
                 if (bindingConfig == null) {
                     bindingConfig = new SoapBindingConfiguration();
                 }
-                ((SoapBindingConfiguration)bindingConfig).setStyle(serviceFactory.getStyle());
+                if (bindingConfig instanceof SoapBindingConfiguration) {
+                    ((SoapBindingConfiguration)bindingConfig).setStyle(serviceFactory.getStyle());
+                }
             }
-            return mgr.getBindingFactory(binding).createBindingInfo(serviceFactory.getService(),
+
+            bindingFactory = mgr.getBindingFactory(binding);
+            
+            return bindingFactory.createBindingInfo(serviceFactory.getService(),
                                                                     binding, bindingConfig);
         } catch (BusException ex) {
             throw new ServiceConstructionException(
@@ -283,7 +294,6 @@
         this.serviceClass = serviceClass;
     }
 
-
     public DestinationFactory getDestinationFactory() {
         return destinationFactory;
     }
@@ -333,6 +343,10 @@
 
     public void setWsdlURL(String wsdlURL) {
         getServiceFactory().setWsdlURL(wsdlURL);
+    }
+
+    public BindingFactory getBindingFactory() {
+        return bindingFactory;
     }
     
     public ConduitSelector getConduitSelector() {

Modified: incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/ServerFactoryBean.java Mon Apr 16 16:01:51 2007
@@ -29,7 +29,6 @@
 import org.apache.cxf.service.factory.ServiceConstructionException;
 import org.apache.cxf.service.invoker.BeanInvoker;
 import org.apache.cxf.service.invoker.Invoker;
-import org.apache.cxf.transport.ChainInitiationObserver;
 import org.apache.cxf.ws.AbstractWSFeature;
 
 /**
@@ -86,9 +85,9 @@
             server = new ServerImpl(getBus(), 
                                     ep, 
                                     getDestinationFactory(), 
-                                    new ChainInitiationObserver(ep, getBus()));
+                                    getBindingFactory());
             
-            if (serviceBean != null && ep.getService().getInvoker() == null) {
+            if (serviceBean != null) {
                 ep.getService().setInvoker(createInvoker());
             }
             

Added: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java (added)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java Mon Apr 16 16:01:51 2007
@@ -0,0 +1,104 @@
+/**
+ * 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.cxf.frontend.soap;
+
+import org.apache.cxf.binding.soap.Soap12;
+import org.apache.cxf.binding.soap.SoapBindingConfiguration;
+import org.apache.cxf.endpoint.ServerImpl;
+import org.apache.cxf.frontend.ServerFactoryBean;
+import org.apache.cxf.interceptor.Fault;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.phase.AbstractPhaseInterceptor;
+import org.apache.cxf.phase.Phase;
+import org.apache.cxf.service.factory.AbstractSimpleFrontendTest;
+import org.apache.cxf.service.factory.HelloService;
+import org.apache.cxf.service.factory.HelloServiceImpl;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MultipleEndpointObserver;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.junit.Test;
+
+public class SoapBindingSelectionTest extends AbstractSimpleFrontendTest {
+
+    boolean service1Invoked;
+    boolean service2Invoked;
+    
+    @Test
+    public void testMultipleSoapBindings() throws Exception {
+        ServerFactoryBean svrBean1 = new ServerFactoryBean();
+        svrBean1.setAddress("http://localhost/Hello");
+        svrBean1.setServiceClass(HelloService.class);
+        svrBean1.setServiceBean(new HelloServiceImpl());
+        svrBean1.setBus(getBus());
+        svrBean1.getInInterceptors().add(new AbstractPhaseInterceptor<Message>() {
+            @Override
+            public String getPhase() {
+                return Phase.USER_LOGICAL;
+            }
+
+            public void handleMessage(Message message) throws Fault {
+                service1Invoked = true;
+            }
+        });
+        svrBean1.create();
+        
+        ServerFactoryBean svrBean2 = new ServerFactoryBean();
+        svrBean2.setAddress("http://localhost/Hello");
+        svrBean2.setServiceClass(HelloService.class);
+        svrBean2.setServiceBean(new HelloServiceImpl());
+        svrBean2.setBus(getBus());
+        svrBean2.getInInterceptors().add(new AbstractPhaseInterceptor<Message>() {
+            @Override
+            public String getPhase() {
+                return Phase.USER_LOGICAL;
+            }
+
+            public void handleMessage(Message message) throws Fault {
+                service2Invoked = true;
+            }
+        });
+        
+        SoapBindingConfiguration config = new SoapBindingConfiguration();
+        config.setVersion(Soap12.getInstance());
+        svrBean2.setBindingConfig(config);
+        
+        ServerImpl server2 = (ServerImpl)svrBean2.create();
+        
+        Destination d = server2.getDestination();
+        MessageObserver mo = d.getMessageObserver();
+        assertTrue(mo instanceof MultipleEndpointObserver);
+        
+        MultipleEndpointObserver meo = (MultipleEndpointObserver) mo;
+        assertEquals(2, meo.getEndpoints().size());
+        
+        invoke("http://localhost/Hello", LocalTransportFactory.TRANSPORT_ID, "soap11.xml");
+        
+        assertTrue(service1Invoked);
+        assertFalse(service2Invoked);
+        
+        service1Invoked = false;
+        
+        invoke("http://localhost/Hello", LocalTransportFactory.TRANSPORT_ID, "soap12.xml");
+        
+        assertFalse(service1Invoked);
+        assertTrue(service2Invoked);
+    }
+
+}

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/SoapBindingSelectionTest.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml (added)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml Mon Apr 16 16:01:51 2007
@@ -0,0 +1,12 @@
+<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+	<soap:Body>
+		<sayHello
+			xmlns="http://factory.service.cxf.apache.org/">
+			<ns2:arg0
+				xmlns:ns2="http://factory.service.cxf.apache.org/"
+				xmlns="http://www.w3.org/2005/08/addressing/wsdl">
+				hello
+			</ns2:arg0>
+		</sayHello>
+	</soap:Body>
+</soap:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap11.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml?view=auto&rev=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml (added)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml Mon Apr 16 16:01:51 2007
@@ -0,0 +1,12 @@
+<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
+	<soap:Body>
+		<sayHello
+			xmlns="http://factory.service.cxf.apache.org/">
+			<ns2:arg0
+				xmlns:ns2="http://factory.service.cxf.apache.org/"
+				xmlns="http://www.w3.org/2005/08/addressing/wsdl">
+				hello
+			</ns2:arg0>
+		</sayHello>
+	</soap:Body>
+</soap:Envelope>
\ No newline at end of file

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/frontend/soap/soap12.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/RountripTest.java Mon Apr 16 16:01:51 2007
@@ -44,7 +44,8 @@
         clientBean.setTransportId("http://schemas.xmlsoap.org/soap/http");
         clientBean.setServiceClass(HelloService.class);
         clientBean.setBus(getBus());
-
+        clientBean.getInInterceptors().add(new LoggingInInterceptor());
+        
         HelloService client = (HelloService) proxyFactory.create();
         
         ClientImpl c = (ClientImpl) clientBean.getClient();

Modified: incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java (original)
+++ incubator/cxf/trunk/rt/frontend/simple/src/test/java/org/apache/cxf/service/factory/ServerFactoryTest.java Mon Apr 16 16:01:51 2007
@@ -87,5 +87,10 @@
             
         }
 
+        public MessageObserver getMessageObserver() {
+            // TODO Auto-generated method stub
+            return null;
+        }
+
     }
 }

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java (original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConduit.java Mon Apr 16 16:01:51 2007
@@ -413,7 +413,7 @@
             decoupledMessageObserver = observer;
         }
         
-        protected synchronized MessageObserver getMessageObserver() {
+        public synchronized MessageObserver getMessageObserver() {
             return decoupledMessageObserver;
         }
     }     

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/Server.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/Server.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/Server.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/mtom/Server.java Mon Apr 16 16:01:51 2007
@@ -19,24 +19,12 @@
 
 package org.apache.cxf.systest.mtom;
 
-import javax.xml.namespace.QName;
 import javax.xml.ws.soap.SOAPBinding;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.endpoint.ServerImpl;
-import org.apache.cxf.jaxws.JAXWSMethodInvoker;
-import org.apache.cxf.jaxws.binding.soap.SOAPBindingImpl;
-import org.apache.cxf.jaxws.support.JaxWsEndpointImpl;
-import org.apache.cxf.jaxws.support.JaxWsImplementorInfo;
-import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.jaxws.EndpointImpl;
 import org.apache.cxf.mtom_xop.TestMtomImpl;
-import org.apache.cxf.service.Service;
-import org.apache.cxf.service.factory.AbstractServiceFactoryBean;
-import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-import org.apache.cxf.transport.ChainInitiationObserver;
-import org.apache.cxf.transport.MessageObserver;
 
 public class Server extends AbstractBusTestServerBase {
 
@@ -44,25 +32,14 @@
         Object implementor = new TestMtomImpl();
         String address = "http://localhost:9036/mime-test";
         try {
-            Bus bus = BusFactory.getDefaultBus();
-            JaxWsImplementorInfo implInfo = new JaxWsImplementorInfo(implementor.getClass());
-            AbstractServiceFactoryBean serviceFactory = new JaxWsServiceFactoryBean(implInfo);
-            serviceFactory.setBus(bus);
-            Service service = serviceFactory.create();
-            QName endpointName = implInfo.getEndpointName();
-            EndpointInfo ei = service.getEndpointInfo(endpointName);
-            service.setInvoker(new JAXWSMethodInvoker(implementor));
-            org.apache.cxf.endpoint.EndpointImpl endpoint = new JaxWsEndpointImpl(bus, service, ei);
-            SOAPBinding jaxWsSoapBinding = new SOAPBindingImpl(ei.getBinding()); 
+            EndpointImpl jaxep = (EndpointImpl) javax.xml.ws.Endpoint.publish(address, implementor);
+            Endpoint ep = jaxep.getServer().getEndpoint();
+            ep.getInInterceptors().add(new TestMultipartMessageInterceptor());
+            ep.getOutInterceptors().add(new TestAttachmentOutInterceptor());
+            
+            SOAPBinding jaxWsSoapBinding = (SOAPBinding) jaxep.getBinding();
             jaxWsSoapBinding.setMTOMEnabled(true);
 
-            endpoint.getInInterceptors().add(new TestMultipartMessageInterceptor());
-            endpoint.getOutInterceptors().add(new TestAttachmentOutInterceptor());
-            
-            endpoint.getEndpointInfo().setAddress(address);
-            MessageObserver observer = new ChainInitiationObserver(endpoint, bus);
-            ServerImpl server = new ServerImpl(bus, endpoint, observer);
-            server.start();
         } catch (Exception e) {
             Thread.currentThread().interrupt();
         }

Modified: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java?view=diff&rev=529436&r1=529435&r2=529436
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java (original)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/versioning/MediatorInInterceptor.java Mon Apr 16 16:01:51 2007
@@ -19,34 +19,20 @@
 
 package org.apache.cxf.systest.versioning;
 
-import java.io.BufferedInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
+import java.util.Set;
 
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 
-import org.apache.cxf.Bus;
-import org.apache.cxf.binding.soap.SoapMessage;
-import org.apache.cxf.binding.soap.SoapVersion;
-import org.apache.cxf.binding.soap.SoapVersionFactory;
-import org.apache.cxf.bus.CXFBusFactory;
-import org.apache.cxf.endpoint.Server;
-import org.apache.cxf.endpoint.ServerRegistry;
-import org.apache.cxf.interceptor.InterceptorChain;
+import org.apache.cxf.endpoint.Endpoint;
+import org.apache.cxf.interceptor.AbstractEndpointSelectionInterceptor;
+import org.apache.cxf.interceptor.Fault;
 import org.apache.cxf.interceptor.StaxInInterceptor;
 import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.AbstractPhaseInterceptor;
 import org.apache.cxf.phase.Phase;
-import org.apache.cxf.staxutils.DepthXMLStreamReader;
-import org.apache.cxf.staxutils.StaxUtils;
-import org.apache.cxf.transport.MessageObserver;
 
 
-public class MediatorInInterceptor extends AbstractPhaseInterceptor<SoapMessage> {
+public class MediatorInInterceptor extends AbstractEndpointSelectionInterceptor {
 
     public MediatorInInterceptor() {
         super();
@@ -54,68 +40,36 @@
         addBefore(StaxInInterceptor.class.getName());
     }
 
-    public void handleMessage(SoapMessage message) {
-        String schemaNamespace = "";
-        InterceptorChain chain = message.getInterceptorChain();
-
-        //scan the incoming message for its schema namespace
-        try {
-            //create a buffered stream so that we get back the original stream after scaning
-            InputStream is = message.getContent(InputStream.class);
-            BufferedInputStream pis = new BufferedInputStream(is);
-            pis.mark(pis.available());
-            message.setContent(InputStream.class, pis);
-
-            //TODO: process attachements
-
-            String encoding = (String)message.get(Message.ENCODING);
-            XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(pis, encoding);
-            DepthXMLStreamReader xmlReader = new DepthXMLStreamReader(reader);
-
-            if (xmlReader.nextTag() == XMLStreamConstants.START_ELEMENT) {
-                String ns = xmlReader.getNamespaceURI();
-                SoapVersion soapVersion = SoapVersionFactory.getInstance().getSoapVersion(ns);
-                //advance just past header
-                StaxUtils.toNextTag(xmlReader, soapVersion.getBody());
-                //past body.
-                xmlReader.nextTag();
+    @Override
+    protected Endpoint selectEndpoint(Message message, Set<Endpoint> eps) {
+        XMLStreamReader xsr = message.getContent(XMLStreamReader.class);
+        if (!xsr.isStartElement()) {
+            try {
+                xsr.nextTag();
+            } catch (XMLStreamException e) {
+                throw new Fault(e);
             }
-
-            schemaNamespace = xmlReader.getName().getNamespaceURI();
-
-            pis.reset();
-        } catch (IOException e) {
-            e.printStackTrace();
-        } catch (XMLStreamException e) {
-            e.printStackTrace();
         }
-
-        //Look up for all available endpoints registered on the bus
-        Bus bus = CXFBusFactory.getDefaultBus();
-        ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
-        List<Server> servers = serverRegistry.getServers();
-
+        
+        if (!xsr.isStartElement()) {
+            return null;
+        }
+        
+        String schemaNamespace = xsr.getNamespaceURI();
+        
         //if the incoming message has a namespace contained "2007/03/21", we redirect the message
         //to the new version of service on endpoint "local://localhost:9027/SoapContext/version2/SoapPort"
-        Server targetServer = null;
-        for (Server server : servers) {
-            targetServer = server;
-            String address = server.getEndpoint().getEndpointInfo().getAddress();
+        for (Endpoint ep : eps) {
             if (schemaNamespace.indexOf("2007/03/21") != -1) {
-                if (address.indexOf("version2") != -1) {
-                    break;
+                if ("2".equals(ep.get("version"))) {
+                    return ep;
                 }
-            } else if (address.indexOf("version1") != -1) {
-                break;
+            } else if ("1".equals(ep.get("version"))) {
+                return ep;
             }
         }
 
-        //Redirect the request
-        MessageObserver mo = targetServer.getMessageObserver();
-        mo.onMessage(message);
-
-        //Now the response has been put in the message, abort the chain 
-        chain.abort();
+        return null;
     }
 
 }



Mime
View raw message