cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From egl...@apache.org
Subject svn commit: r530804 [1/2] - in /incubator/cxf/trunk: api/src/main/java/org/apache/cxf/message/ api/src/main/java/org/apache/cxf/service/model/ api/src/main/java/org/apache/cxf/transport/ api/src/main/java/org/apache/cxf/ws/addressing/ api/src/main/java...
Date Fri, 20 Apr 2007 13:40:15 GMT
Author: eglynn
Date: Fri Apr 20 06:40:11 2007
New Revision: 530804

URL: http://svn.apache.org/viewvc?view=rev&rev=530804
Log:
Applying patch for CXF-542 (Support the factory pattern using a single stateless service endpoint), on behalf of Gary Tully.

Added:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java   (with props)
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractMultiplexDestination.java   (with props)
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualHttpMulitplexClientServerTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberFactoryImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/ManualNumberImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexClientServerTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/MultiplexHttpAddressClientServerTest.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/NumberFactoryImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/NumberImpl.java   (with props)
    incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/cxf.xml   (with props)
    incubator/cxf/trunk/testutils/src/main/resources/wsdl/factory_pattern.wsdl   (with props)
Modified:
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java
    incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
    incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java
    incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
    incubator/cxf/trunk/rt/frontend/simple/src/main/java/org/apache/cxf/frontend/AbstractEndpointFactory.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
    incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
    incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
    incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
    incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
    incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/Messages.properties
    incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
    incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
    incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
    incubator/cxf/trunk/testutils/pom.xml

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/message/MessageImpl.java Fri Apr 20 06:40:11 2007
@@ -32,7 +32,6 @@
 
 public class MessageImpl extends StringMapImpl implements Message {
     private Collection<Attachment> attachments;
-    private Destination destination;
     private Exchange exchange;
     private String id;
     private InterceptorChain interceptorChain;
@@ -52,7 +51,7 @@
     }
     
     public Destination getDestination() {
-        return destination;
+        return get(Destination.class);
     }
 
     public Exchange getExchange() {
@@ -80,7 +79,7 @@
     }
 
     public void setDestination(Destination d) {
-        this.destination = d;
+        put(Destination.class, d);
     }
 
     public void setExchange(Exchange e) {

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/service/model/EndpointInfo.java Fri Apr 20 06:40:11 2007
@@ -21,12 +21,15 @@
 
 import javax.xml.namespace.QName;
 
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
 public class EndpointInfo extends AbstractDescriptionElement {
     String transportId;
     ServiceInfo service;
     BindingInfo binding;
     QName name;
-    String address;
+    EndpointReferenceType address;
     
     public EndpointInfo() {
     }
@@ -60,11 +63,18 @@
     }    
     
     public String getAddress() {
-        return address;
+        return (null != address) ? address.getAddress().getValue() : null;
     }
     
-    public void setAddress(String a) {
-        address = a;
+    public void setAddress(String addr) {
+        if (null == address) {
+            address = EndpointReferenceUtils.getEndpointReference(addr);
+        } else {
+            EndpointReferenceUtils.setAddress(address, addr);
+        }
+    }
+    public void setAddress(EndpointReferenceType endpointReference) {
+        address = endpointReference;
     }
     
     @Override
@@ -86,5 +96,9 @@
         }
         
         return value;
+    }
+
+    public EndpointReferenceType getTarget() {
+        return address;
     }
 }

Added: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java?view=auto&rev=530804
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java (added)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java Fri Apr 20 06:40:11 2007
@@ -0,0 +1,51 @@
+/**
+ * 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.Map;
+
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+
+/**
+ * A MultiplexDestination is a transport-level endpoint capable of receiving
+ * unsolicited incoming messages from different peers for multiple targets 
+ * identified by a unique id.
+ * The disambiguation of targets is handled by higher layers as the target
+ * address is made available as a context property or as a WS-A-To header
+ */
+
+public interface MultiplexDestination extends Destination {
+    
+    /**
+     * @return the a reference containing the id that is 
+     * associated with this Destination
+     */
+    EndpointReferenceType getAddressWithId(String id);
+    
+    /**
+     * @param contextMap for this invocation. Obtained for example from 
+     * JAX-WS WebServiceContext.getMessageContext(). The context will
+     * either contain the WS-A To content and/or some property that 
+     * identifies the target address, eg MessageContext.PATH_INFO for
+     * the current invocation
+     * @return the id associated with the current invocation
+     */
+    String getId(Map contextMap);
+}

Propchange: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/transport/MultiplexDestination.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/ws/addressing/AddressingProperties.java Fri Apr 20 06:40:11 2007
@@ -28,13 +28,19 @@
      * Accessor for the <b>To</b> property.
      * @return current value of To property
      */
+    EndpointReferenceType getToEndpointReference();
+    
+    /**
+     * Accessor for the <b>To</b> property.
+     * @return current value of To property
+     */
     AttributedURIType getTo();
 
     /**
      * Mutator for the <b>To</b> property.
-     * @param iri new value for To property
+     * @param epr new value for To property
      */
-    void setTo(AttributedURIType iri);
+    void setTo(EndpointReferenceType epr);
 
     /**
      * Accessor for the <b>MessageID</b> property.

Modified: incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java (original)
+++ incubator/cxf/trunk/api/src/main/java/org/apache/cxf/wsdl/EndpointReferenceUtils.java Fri Apr 20 06:40:11 2007
@@ -22,6 +22,7 @@
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 import java.util.WeakHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -47,7 +48,6 @@
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
-
 import org.xml.sax.SAXException;
 
 import org.apache.cxf.Bus;
@@ -55,15 +55,19 @@
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.endpoint.EndpointResolverRegistry;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.endpoint.ServerRegistry;
 import org.apache.cxf.service.model.SchemaInfo;
 import org.apache.cxf.service.model.ServiceInfo;
+import org.apache.cxf.transport.Destination;
+import org.apache.cxf.transport.MultiplexDestination;
 import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.MetadataType;
-import org.apache.cxf.ws.addressing.ObjectFactory;
 import org.apache.cxf.ws.addressing.wsdl.AttributedQNameType;
 import org.apache.cxf.ws.addressing.wsdl.ServiceNameType;
 
+
 /**
  * Provides utility methods for obtaining endpoint references, wsdl definitions, etc.
  */
@@ -77,6 +81,11 @@
 
     private static final QName WSDL_LOCATION = new QName("http://www.w3.org/2006/01/wsdl-instance",
                                                          "wsdlLocation");
+    
+    private static final org.apache.cxf.ws.addressing.wsdl.ObjectFactory WSA_WSDL_OBJECT_FACTORY = 
+        new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
+    private static final org.apache.cxf.ws.addressing.ObjectFactory WSA_OBJECT_FACTORY = 
+        new org.apache.cxf.ws.addressing.ObjectFactory();
 
     
     private EndpointReferenceUtils() {
@@ -124,12 +133,11 @@
     }
     
     public static JAXBElement<ServiceNameType> getServiceNameType(QName serviceName, String portName) {
-        ServiceNameType serviceNameType = new ServiceNameType();
+        ServiceNameType serviceNameType = WSA_WSDL_OBJECT_FACTORY.createServiceNameType();
         serviceNameType.setValue(serviceName);
         serviceNameType.setEndpointName(portName);
-        org.apache.cxf.ws.addressing.wsdl.ObjectFactory objectFactory = 
-            new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
-        return objectFactory.createServiceName(serviceNameType);
+        
+        return WSA_WSDL_OBJECT_FACTORY.createServiceName(serviceNameType);
     }
     
     /**
@@ -201,18 +209,17 @@
     
     public static void setInterfaceName(EndpointReferenceType ref, QName portTypeName) {
         if (null != portTypeName) {
-            AttributedQNameType interfaceNameType = new AttributedQNameType();
+            AttributedQNameType interfaceNameType =
+                WSA_WSDL_OBJECT_FACTORY.createAttributedQNameType();
             
             interfaceNameType.setValue(portTypeName);
             
-            org.apache.cxf.ws.addressing.wsdl.ObjectFactory objectFactory = 
-                new org.apache.cxf.ws.addressing.wsdl.ObjectFactory();
             JAXBElement<AttributedQNameType> jaxbElement = 
-                objectFactory.createInterfaceName(interfaceNameType);
+                WSA_WSDL_OBJECT_FACTORY.createInterfaceName(interfaceNameType);
 
             MetadataType mt = ref.getMetadata();
             if (null == mt) {
-                mt = new MetadataType();
+                mt = WSA_OBJECT_FACTORY.createMetadataType();
                 ref.setMetadata(mt);
             }
             mt.getAny().add(jaxbElement);
@@ -260,7 +267,7 @@
         
         MetadataType metadata = ref.getMetadata();
         if (null == metadata) {
-            metadata = new MetadataType();
+            metadata = WSA_OBJECT_FACTORY.createMetadataType();
             ref.setMetadata(metadata);
         }
 
@@ -529,7 +536,7 @@
      * @param address - the address
      */
     public static void setAddress(EndpointReferenceType ref, String address) {
-        AttributedURIType a = new ObjectFactory().createAttributedURIType();
+        AttributedURIType a = WSA_OBJECT_FACTORY.createAttributedURIType();
         a.setValue(address);
         ref.setAddress(a);
     }
@@ -543,8 +550,8 @@
     public static EndpointReferenceType getEndpointReference(URL wsdlUrl, 
                                                              QName serviceName,
                                                              String portName) {
-        EndpointReferenceType reference = new EndpointReferenceType();
-        reference.setMetadata(new MetadataType());
+        EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+        reference.setMetadata(WSA_OBJECT_FACTORY.createMetadataType());
         setServiceAndPortName(reference, serviceName, portName);
         //TODO To Ensure it is a valid URI syntax.
         setWSDLLocation(reference, wsdlUrl.toString());
@@ -552,6 +559,21 @@
         return reference;
     }
     
+    
+    /**
+     * Create a duplicate endpoint reference sharing all atributes
+     * @param ret to duplicate
+     * @return EndpointReferenceType - the duplicate endpoint reference
+     */
+    public static EndpointReferenceType duplicate(EndpointReferenceType ref) {
+
+        EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+        reference.setMetadata(ref.getMetadata());
+        reference.getAny().addAll(ref.getAny());
+        reference.setAddress(ref.getAddress());
+        return reference;
+    }
+    
     /**
      * Create an endpoint reference for the provided address.
      * @param address - address URI
@@ -559,18 +581,25 @@
      */
     public static EndpointReferenceType getEndpointReference(String address) {
 
-        EndpointReferenceType reference = new EndpointReferenceType();
+        EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
         setAddress(reference, address);
         return reference;
     }
     
+    public static EndpointReferenceType getEndpointReference(AttributedURIType address) {
+
+        EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
+        reference.setAddress(address);
+        return reference;
+    }    
+    
     /**
      * Create an anonymous endpoint reference.
      * @return EndpointReferenceType - the endpoint reference
      */
     public static EndpointReferenceType getAnonymousEndpointReference() {
         
-        EndpointReferenceType reference = new EndpointReferenceType();
+        EndpointReferenceType reference = WSA_OBJECT_FACTORY.createEndpointReferenceType();
         setAddress(reference, ANONYMOUS_ADDRESS);
         return reference;
     }
@@ -603,7 +632,72 @@
 
     private static String getService(String content) {
         return content.substring(content.indexOf(":") + 1, content.length());
-    }    
-    
+    }
+
+    /**
+     * Obtain a multiplexed endpoint reference for the deployed service that contains the provided id
+     * @param serviceQName identified the target service
+     * @param portName identifies a particular port of the service, may be null
+     * @param id that must be embedded in the returned reference
+     * @param bus the current bus
+     * @return a new reference or null if the target destination does not support destination mutiplexing  
+     */
+    public static EndpointReferenceType getEndpointReferenceWithId(QName serviceQName, 
+                                                                   String portName, 
+                                                                   String id, 
+                                                                   Bus bus) {
+        EndpointReferenceType epr = null;        
+        MultiplexDestination destination = getMatchingMultiplexDestination(serviceQName, portName, bus);
+        if (null != destination) {
+            epr = destination.getAddressWithId(id);
+        }
+        return epr;
+    }
     
+    /**
+     * Obtain the id String from the endpoint reference of the current dispatch. 
+     * @param contextMap the current message context 
+     * @return the id embedded in the current endpoint reference or null if not found
+     */
+    public static String getEndpointReferenceId(Map messageContext) {
+        String id = null;
+        Destination destination = (Destination) messageContext.get(Destination.class.getName());
+        if (destination instanceof MultiplexDestination) {
+            id = ((MultiplexDestination) destination).getId(messageContext);
+        }
+        return id;
+    }
+    
+    private static MultiplexDestination getMatchingMultiplexDestination(QName serviceQName, String portName,
+                                                                        Bus bus) {
+        MultiplexDestination destination = null;
+        ServerRegistry serverRegistry = (ServerRegistry)bus.getExtension(ServerRegistry.class);
+        if (null != serverRegistry) {
+            List<Server> servers = serverRegistry.getServers();
+            for (Server s : servers) {
+                QName targetServiceQName = s.getEndpoint().getEndpointInfo().getService().getName();
+                if (serviceQName.equals(targetServiceQName) && portNameMatches(s, portName)) {
+                    Destination dest = s.getDestination();
+                    if (dest instanceof MultiplexDestination) {
+                        destination = (MultiplexDestination)dest;
+                        break;
+                    }
+                }
+            }
+        } else {
+            LOG.log(Level.WARNING,
+                    "Failed to locate service matching " + serviceQName 
+                    + ", because the bus ServerRegistry extension provider is null");
+        }
+        return destination;
+    }
+
+    private static boolean portNameMatches(Server s, String portName) {
+        boolean ret = false;
+        if (null == portName 
+            || portName.equals(s.getEndpoint().getEndpointInfo().getName().getLocalPart())) {
+            return true;
+        }
+        return ret;
+    }   
 }

Added: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractMultiplexDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractMultiplexDestination.java?view=auto&rev=530804
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractMultiplexDestination.java (added)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractMultiplexDestination.java Fri Apr 20 06:40:11 2007
@@ -0,0 +1,103 @@
+/**
+ * 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.Map;
+
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.ws.addressing.AddressingProperties;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
+
+public abstract class AbstractMultiplexDestination extends AbstractDestination implements
+    MultiplexDestination {
+
+    private static final QName MULTIPLEX_ID_QNAME = new QName("http://multiplex.transport.cxf.apache.org",
+                                                              "id");
+
+    public AbstractMultiplexDestination(EndpointReferenceType ref, EndpointInfo ei) {
+        super(ref, ei);
+    }
+
+    /**
+     * Builds an new endpoint reference using the current target reference as a template. 
+     * The supplied id is endcoded using a reference parameter.
+     * This requires the ws-a interceptors to propagate the reference parameters
+     * on subsequent invokes using the returned reference.
+     * @param the id to encode in the new reference
+     * @return the new reference with the id encoded as a reference parameter
+     * @see org.apache.cxf.transport.MultiplexDestination#getAddressWithId(java.lang.String)
+      
+     */
+    public EndpointReferenceType getAddressWithId(String id) {
+        EndpointReferenceType epr = EndpointReferenceUtils.duplicate(reference);
+        ReferenceParametersType newParams = new org.apache.cxf.ws.addressing.ObjectFactory()
+            .createReferenceParametersType();
+        
+        ReferenceParametersType existingParams = epr.getReferenceParameters();
+        if (null != existingParams) {
+            newParams.getAny().addAll(existingParams.getAny());
+        }
+        
+        newParams.getAny().add(new JAXBElement<String>(MULTIPLEX_ID_QNAME, String.class, id));
+        epr.setReferenceParameters(newParams);
+        return epr;
+    }
+
+    /**
+     * Obtain id from reference parameters of the ws-a to address
+     * Requires the existance of ws-a interceptors on dispatch path to provide access 
+     * to the ws-a headers
+     * @param the current invocation or message context
+     * @return the id from the reference parameters of the  ws-a-to address or null if not found
+     * @see org.apache.cxf.transport.MultiplexDestination#getId(java.util.Map)
+     */
+    public String getId(Map contextMap) {
+        String markedParam = null;
+        AddressingProperties maps = (AddressingProperties)contextMap
+            .get(SERVER_ADDRESSING_PROPERTIES_INBOUND);
+        if (null != maps) {
+            EndpointReferenceType toEpr = maps.getToEndpointReference();
+            if (null != toEpr) {
+                markedParam = extractStringElementFromAny(MULTIPLEX_ID_QNAME, toEpr);
+            }
+        }
+        return markedParam;
+    }
+
+    private String extractStringElementFromAny(QName elementQName, EndpointReferenceType epr) {
+        String elementStringValue = null;
+        if (null != epr.getReferenceParameters()) {
+            for (Object o : epr.getReferenceParameters().getAny()) {
+                if (o instanceof JAXBElement) {
+                    JAXBElement el = (JAXBElement)o;
+                    if (el.getName().equals(elementQName)) {
+                        elementStringValue = (String)el.getValue();
+                    }
+                }
+            }
+        }
+        return elementStringValue;
+    }
+}

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

Modified: incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java (original)
+++ incubator/cxf/trunk/rt/core/src/main/java/org/apache/cxf/transport/AbstractObservable.java Fri Apr 20 06:40:11 2007
@@ -73,7 +73,7 @@
     }
     
     /**
-     * Get the target reference .
+     * Get the target endpoint reference.
      * 
      * @param ei the corresponding EndpointInfo
      * @param t the given target EPR if available
@@ -89,11 +89,15 @@
             AttributedURIType address = new AttributedURIType();
             address.setValue(ei.getAddress());
             ref.setAddress(address);
+            if (ei.getService() != null) {
+                EndpointReferenceUtils.setServiceAndPortName(ref, 
+                                                             ei.getService().getName(), 
+                                                             ei.getName().getLocalPart());
+            }
         } else {
             ref = t;
         }
         return EndpointReferenceUtils.resolve(ref, bus);
-        //return ref;
     }
     
     /**

Modified: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java (original)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/ServiceImpl.java Fri Apr 20 06:40:11 2007
@@ -68,6 +68,8 @@
 import org.apache.cxf.transport.DestinationFactory;
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.workqueue.OneShotAsyncExecutor;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.apache.cxf.wsdl11.WSDLServiceFactory;
 
 public class ServiceImpl extends ServiceDelegate {
@@ -214,7 +216,7 @@
 
     public <T> T getPort(Class<T> type) {
         try {
-            return createPort(null, type);
+            return createPort(null, null, type);
         } catch (ServiceConstructionException e) {
             throw new WebServiceException(e);
         }  
@@ -225,11 +227,24 @@
             throw new WebServiceException(BUNDLE.getString("PORT_NAME_NULL_EXC"));
         }
         try {
-            return createPort(portName, type);
+            return createPort(portName, null, type);
         } catch (ServiceConstructionException e) {
             throw new WebServiceException(e);
         }  
     }
+    
+    public <T> T getPort(EndpointReferenceType endpointReference,
+                            Class<T> type) {
+        QName serviceQName = EndpointReferenceUtils.getServiceName(endpointReference);
+        String portName = EndpointReferenceUtils.getPortName(endpointReference);
+        
+        QName portQName = null;
+        if (portName != null && serviceQName != null) {
+            portQName = new QName(serviceQName.getNamespaceURI(), portName);
+        }
+        
+        return createPort(portQName, endpointReference, type);
+    }    
 
     public Iterator<QName> getPorts() {
         return ports.iterator();
@@ -255,8 +270,9 @@
         return bus;
     }
 
-    protected <T> T createPort(QName portName, Class<T> serviceEndpointInterface) {
+    protected <T> T createPort(QName portName, EndpointReferenceType epr, Class<T> serviceEndpointInterface) {
         LOG.log(Level.FINE, "creating port for portName", portName);
+        LOG.log(Level.FINE, "endpoint reference:", epr);
         LOG.log(Level.FINE, "endpoint interface:", serviceEndpointInterface);
 
         JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
@@ -278,6 +294,9 @@
             serviceFactory.setEndpointName(portName);
         }
         
+        if (epr != null) {
+            clientFac.setEndpointReference(epr);
+        }
         PortInfoImpl portInfo = portInfos.get(portName);
         if (portInfo != null) {
             clientFac.setBindingId(portInfo.getBindingID());

Added: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java?view=auto&rev=530804
==============================================================================
--- incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java (added)
+++ incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java Fri Apr 20 06:40:11 2007
@@ -0,0 +1,70 @@
+/**
+ * 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.jaxws.support;
+
+import java.lang.reflect.Field;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.ws.Service;
+import javax.xml.ws.WebServiceException;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.jaxws.ServiceImpl;
+
+/**
+ * A utility that allows access to the 'private' implementation specific delegate
+ * of a Service. Usefull when extensions to the JAXWS Service supported methods
+ * are required.
+ */
+public final class ServiceDelegateAccessor {
+
+    private static final Logger LOG = LogUtils.getL7dLogger(ServiceDelegateAccessor.class);
+
+    private static final String DELEGATE_FIELD_NAME = "delegate";
+
+    private ServiceDelegateAccessor() {        
+    }
+    
+    /**
+     * Get the delegate reference from the Service private field. This method
+     * uses Field.setAccessible() which, in the presence of a SecurityManager,
+     * requires the suppressAccessChecks permission
+     * 
+     * @param service the taraget service
+     * @return the implementation delegate
+     * @throws WebServiceException if access to the field fails for any reason
+     */
+    public static ServiceImpl get(Service service) {
+        ServiceImpl delegate = null;
+        try {
+            Field delegateField = Service.class.getDeclaredField(DELEGATE_FIELD_NAME);
+            delegateField.setAccessible(true);
+            delegate = (ServiceImpl)delegateField.get(service);
+        } catch (Exception e) {
+            WebServiceException wse = new WebServiceException("Failed to access Field named "
+                                                              + DELEGATE_FIELD_NAME + " of Service instance "
+                                                              + service, e);
+            LOG.log(Level.SEVERE, e.getMessage(), e);
+            throw wse;
+        }
+        return delegate;
+    }
+}

Propchange: incubator/cxf/trunk/rt/frontend/jaxws/src/main/java/org/apache/cxf/jaxws/support/ServiceDelegateAccessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

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=530804&r1=530803&r2=530804
==============================================================================
--- 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 Fri Apr 20 06:40:11 2007
@@ -48,6 +48,7 @@
 import org.apache.cxf.transport.DestinationFactoryManager;
 import org.apache.cxf.transport.local.LocalTransportFactory;
 import org.apache.cxf.ws.AbstractWSFeature;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.wsdl11.WSDLEndpointFactory;
 
 public abstract class AbstractEndpointFactory extends AbstractBasicInterceptorProvider {
@@ -65,6 +66,7 @@
     private Map<String, Object> properties;
     private List<AbstractWSFeature> features;
     private BindingConfiguration bindingConfig;
+    private EndpointReferenceType endpointReference;
     private ConduitSelector conduitSelector;
     
     protected Endpoint createEndpoint() throws BusException, EndpointException {
@@ -103,6 +105,9 @@
             ei.setAddress(getAddress()); 
         }
 
+        if (endpointReference != null) {
+            ei.setAddress(endpointReference);
+        }
         Endpoint ep = service.getEndpoints().get(ei.getName());
         
         if (ep == null) {
@@ -318,6 +323,10 @@
         this.endpointName = endpointName;
     }
 
+    public void setEndpointReference(EndpointReferenceType epr) {
+        endpointReference = epr;
+    }
+    
     public Map<String, Object> getProperties() {
         return properties;
     }

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/JettyHTTPDestinationTest.java Fri Apr 20 06:40:11 2007
@@ -19,7 +19,6 @@
 
 package org.apache.cxf.transport.http_jetty;
 
-
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -31,6 +30,8 @@
 
 import javax.servlet.ServletInputStream;
 import javax.servlet.ServletOutputStream;
+import javax.xml.bind.JAXBElement;
+import javax.xml.namespace.QName;
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.bus.CXFBusImpl;
@@ -46,6 +47,7 @@
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.security.transport.TLSSessionInfo;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.Destination;
 import org.apache.cxf.transport.MessageObserver;
@@ -53,6 +55,7 @@
 import org.apache.cxf.transports.http.QueryHandler;
 import org.apache.cxf.transports.http.QueryHandlerRegistry;
 import org.apache.cxf.transports.http.configuration.HTTPServerPolicy;
+import org.apache.cxf.ws.addressing.AddressingProperties;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.policy.PolicyEngine;
 import org.apache.cxf.wsdl.EndpointReferenceUtils;
@@ -63,6 +66,7 @@
 import org.mortbay.jetty.HttpFields;
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.Response;
+import static org.apache.cxf.ws.addressing.JAXWSAConstants.SERVER_ADDRESSING_PROPERTIES_INBOUND;
 
 public class JettyHTTPDestinationTest extends Assert {
     protected static final String AUTH_HEADER = "Authorization";
@@ -123,6 +127,12 @@
         assertEquals("unexpected address",
                      EndpointReferenceUtils.getAddress(ref),
                      StringUtils.addDefaultPortIfMissing(EndpointReferenceUtils.getAddress(address)));
+        assertEquals("unexpected service name local part",
+                     EndpointReferenceUtils.getServiceName(ref).getLocalPart(),
+                     "Service");
+        assertEquals("unexpected portName",
+                     EndpointReferenceUtils.getPortName(ref),
+                     "Port");
     }
     
     @Test
@@ -130,7 +140,10 @@
         transportFactory = new JettyHTTPTransportFactory();
         transportFactory.setBus(new CXFBusImpl());
         
-        EndpointInfo ei = new EndpointInfo();
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        EndpointInfo ei = new EndpointInfo(serviceInfo, "");
+        ei.setName(new QName("bla", "Port"));
         ei.setAddress("http://foo");
         Destination d1 = transportFactory.getDestination(ei);
         
@@ -296,7 +309,11 @@
         bus = new CXFBusImpl();
         
         transportFactory = new JettyHTTPTransportFactory();
-        endpointInfo = new EndpointInfo();
+        
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        endpointInfo = new EndpointInfo(serviceInfo, "");
+        endpointInfo.setName(new QName("bla", "Port"));
         endpointInfo.addExtensor(policy); 
         endpointInfo.addExtensor(new SSLServerPolicy()); 
         
@@ -311,6 +328,70 @@
         assertEquals(policy, dest.getServer());
     }
         
+    @Test
+    public void testMultiplexGetAddressWithId() throws Exception {
+        destination = setUpDestination();
+        final String id = "ID2";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        assertNotNull(refWithId);
+        assertNotNull(refWithId.getReferenceParameters());
+        assertNotNull(refWithId.getReferenceParameters().getAny());
+        assertTrue("it is an element", 
+                   refWithId.getReferenceParameters().getAny().get(0) instanceof JAXBElement);
+        JAXBElement el = (JAXBElement) refWithId.getReferenceParameters().getAny().get(0);
+        assertEquals("match our id", el.getValue(), id);
+    }
+    
+    @Test
+    public void testMultiplexGetAddressWithIdForAddress() throws Exception {
+        destination = setUpDestination();
+        destination.setMultiplexWithAddress(true);
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        assertNotNull(refWithId);
+        assertNull(refWithId.getReferenceParameters());
+        assertTrue("match our id", EndpointReferenceUtils.getAddress(refWithId).indexOf(id) != -1);
+    }
+    
+    @Test
+    public void testMultiplexGetIdForAddress() throws Exception {
+        destination = setUpDestination();
+        destination.setMultiplexWithAddress(true);
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        String pathInfo = EndpointReferenceUtils.getAddress(refWithId);
+        
+        Map<String, Object> context = new HashMap<String, Object>();
+        assertNull("fails with no context", destination.getId(context));
+        
+        context.put(Message.PATH_INFO, pathInfo);
+        String result = destination.getId(context);
+        assertNotNull(result);
+        assertEquals("match our id", result, id);
+    }
+    
+    @Test
+    public void testMultiplexGetId() throws Exception {
+        destination = setUpDestination();
+        
+        final String id = "ID3";
+        EndpointReferenceType refWithId = destination.getAddressWithId(id);
+        
+        Map<String, Object> context = new HashMap<String, Object>();
+        assertNull("fails with no context", destination.getId(context));
+        
+        AddressingProperties maps = EasyMock.createMock(AddressingProperties.class);
+        maps.getToEndpointReference();
+        EasyMock.expectLastCall().andReturn(refWithId);
+        EasyMock.replay(maps);      
+        context.put(SERVER_ADDRESSING_PROPERTIES_INBOUND, maps);
+        String result = destination.getId(context);
+        assertNotNull(result);
+        assertEquals("match our id", result, id);
+    }
+    
     private JettyHTTPDestination setUpDestination()
         throws Exception {
         return setUpDestination(false, false);
@@ -341,7 +422,10 @@
         transportFactory.setBus(bus);
         
         engine = EasyMock.createMock(ServerEngine.class);
-        endpointInfo = new EndpointInfo();
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        endpointInfo = new EndpointInfo(serviceInfo, "");
+        endpointInfo.setName(new QName("bla", "Port"));
         endpointInfo.setAddress(NOWHERE + "bar/foo");
        
         endpointInfo.addExtensor(policy);

Modified: incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java (original)
+++ incubator/cxf/trunk/rt/transports/http-jetty/src/test/java/org/apache/cxf/transport/http_jetty/spring/ApplicationContextTest.java Fri Apr 20 06:40:11 2007
@@ -26,6 +26,7 @@
 import org.apache.cxf.configuration.spring.ConfigurerImpl;
 import org.apache.cxf.configuration.spring.JaxbClassPathXmlApplicationContext;
 import org.apache.cxf.service.model.EndpointInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.ConduitInitiatorManager;
 import org.apache.cxf.transport.Destination;
@@ -50,7 +51,9 @@
         
         ConfigurerImpl cfg = new ConfigurerImpl(ctx);
         
-        EndpointInfo info = new EndpointInfo();
+        ServiceInfo serviceInfo = new ServiceInfo();
+        serviceInfo.setName(new QName("bla", "Service"));        
+        EndpointInfo info = new EndpointInfo(serviceInfo, "");
         info.setName(new QName("urn:test:ns", "Foo"));
         info.setAddress("http://localhost:9000");
         

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPDestination.java Fri Apr 20 06:40:11 2007
@@ -50,6 +50,7 @@
 import org.apache.cxf.message.Message;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.AbstractMultiplexDestination;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.http.policy.PolicyUtils;
@@ -57,12 +58,13 @@
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.policy.Assertor;
 import org.apache.cxf.ws.policy.PolicyEngine;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 /**
  * Common base for HTTP Destination implementations.
  */
-public abstract class AbstractHTTPDestination extends AbstractDestination 
-    implements Configurable, Assertor {
+public abstract class AbstractHTTPDestination extends AbstractMultiplexDestination implements Configurable,
+    Assertor {
     
     public static final String HTTP_REQUEST = "HTTP.REQUEST";
     public static final String HTTP_RESPONSE = "HTTP.RESPONSE";
@@ -81,7 +83,8 @@
     protected SSLServerPolicy sslServer;
     protected String contextMatchStrategy = "stem";
     protected boolean fixedParameterOrder;
-    
+    protected boolean multiplexWithAddress;
+
     /**
      * Constructor
      * 
@@ -417,6 +420,54 @@
         return beanName;
     }
 
+    /*
+     * Implement multiplex via the address URL to avoid the need for ws-a.
+     * Requires contextMatchStrategy of stem.
+     * 
+     * @see org.apache.cxf.transport.AbstractMultiplexDestination#getAddressWithId(java.lang.String)
+     */
+    public EndpointReferenceType getAddressWithId(String id) {
+        EndpointReferenceType ref = null;
+
+        if (isMultiplexWithAddress()) {
+            String address = EndpointReferenceUtils.getAddress(reference);
+            ref = EndpointReferenceUtils.duplicate(reference);
+            if (address.endsWith("/")) {
+                EndpointReferenceUtils.setAddress(ref, address + id);
+            } else {
+                EndpointReferenceUtils.setAddress(ref, address + "/" + id);
+            }
+        } else {
+            ref = super.getAddressWithId(id);
+        }
+        return ref;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.cxf.transport.AbstractMultiplexDestination#getId(java.util.Map)
+     */
+    public String getId(Map context) {
+        String id = null;
+
+        if (isMultiplexWithAddress()) {
+            String address = (String)context.get(Message.PATH_INFO);
+            if (null != address) {
+                int afterLastSlashIndex = address.lastIndexOf("/") + 1;
+                if (afterLastSlashIndex > 0 && afterLastSlashIndex < address.length()) {
+                    id = address.substring(afterLastSlashIndex);
+                }
+            } else {
+                getLogger().log(Level.WARNING,
+                                new org.apache.cxf.common.i18n.Message("MISSING_PATH_INFO", LOG).toString());
+            }
+        } else {
+            return super.getId(context);
+        }   
+        return id;
+    }
+
     public AuthorizationPolicy getAuthorization() {
         return authorization;
     }
@@ -439,6 +490,14 @@
 
     public void setFixedParameterOrder(boolean fixedParameterOrder) {
         this.fixedParameterOrder = fixedParameterOrder;
+    }
+
+    public boolean isMultiplexWithAddress() {
+        return multiplexWithAddress;
+    }
+
+    public void setMultiplexWithAddress(boolean multiplexWithAddress) {
+        this.multiplexWithAddress = multiplexWithAddress;
     }
 
     public HTTPServerPolicy getServer() {

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/AbstractHTTPTransportFactory.java Fri Apr 20 06:40:11 2007
@@ -144,7 +144,7 @@
      * to calling getConduit without an EndpointReferenceType.
      */
     public Conduit getConduit(EndpointInfo endpointInfo) throws IOException {
-        return getConduit(endpointInfo, null);
+        return getConduit(endpointInfo, endpointInfo.getTarget());
     }
 
     /**

Modified: incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties (original)
+++ incubator/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/Messages.properties Fri Apr 20 06:40:11 2007
@@ -21,3 +21,4 @@
 UNEXPECTED_RESPONSE_TYPE_MSG = Unexpected response type {0}
 NULL_RESPONSE_MSG = Response object is null
 DECOUPLED_RESPONSE_FAILED_MSG = Decouple response failed
+MISSING_PATH_INFO = PATH_INFO not present in message context, multiplex id is unavailable. Ensure the portName passed to getCurrentEndpointReferenceId is correct if the service has multiple ports

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java (original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSDestination.java Fri Apr 20 06:40:11 2007
@@ -49,7 +49,7 @@
 import org.apache.cxf.message.MessageImpl;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.AbstractConduit;
-import org.apache.cxf.transport.AbstractDestination;
+import org.apache.cxf.transport.AbstractMultiplexDestination;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.MessageObserver;
@@ -59,7 +59,7 @@
 
 
 
-public class JMSDestination extends AbstractDestination implements Configurable, JMSTransport {
+public class JMSDestination extends AbstractMultiplexDestination implements Configurable, JMSTransport {
         
     protected static final String BASE_BEAN_NAME_SUFFIX = ".jms-destination-base";
 

Modified: incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java (original)
+++ incubator/cxf/trunk/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSTransportFactory.java Fri Apr 20 06:40:11 2007
@@ -55,7 +55,7 @@
     }
         
     public Conduit getConduit(EndpointInfo targetInfo) throws IOException {        
-        return getConduit(targetInfo, null);
+        return getConduit(targetInfo, targetInfo.getTarget());
     }
 
     public Conduit getConduit(EndpointInfo endpointInfo, EndpointReferenceType target) throws IOException {

Modified: incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java (original)
+++ incubator/cxf/trunk/rt/transports/jms/src/test/java/org/apache/cxf/transport/jms/JMSDestinationTest.java Fri Apr 20 06:40:11 2007
@@ -32,6 +32,7 @@
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
 import org.apache.cxf.transport.MessageObserver;
+import org.apache.cxf.transport.MultiplexDestination;
 import org.easymock.classextension.EasyMock;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -317,5 +318,16 @@
         // wait for a while for the jms session recycling
         Thread.sleep(1000);
         destination.shutdown();
+    }
+    
+    @Test
+    public void testIsMultiplexCapable() throws Exception {
+        inMessage = null;
+        setupServiceInfo("http://cxf.apache.org/hello_world_jms", 
+                         "/wsdl/jms_test.wsdl", 
+                         "HelloWorldService", 
+                         "HelloWorldPort");
+        final JMSDestination destination = setupJMSDestination(true);
+        assertTrue("is multiplex", destination instanceof MultiplexDestination);
     }
 }

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/AddressingPropertiesImpl.java Fri Apr 20 06:40:11 2007
@@ -23,7 +23,7 @@
  * Abstraction of Message Addressing Properties. 
  */
 public class AddressingPropertiesImpl implements AddressingProperties {
-    private AttributedURIType to;
+    private EndpointReferenceType to;
     private AttributedURIType messageID;
     private EndpointReferenceType replyTo;
     private EndpointReferenceType faultTo;
@@ -47,20 +47,24 @@
         namespaceURI = uri;
     }
 
+    public EndpointReferenceType getToEndpointReference() {
+        return to;
+    }
+
     /**
      * Accessor for the <b>To</b> property.
      * @return To property
      */
     public AttributedURIType getTo() {
-        return to;
+        return null != to ? to.getAddress() : null;
     }
-
+    
     /**
      * Mutator for the <b>To</b> property.
      * @param iri new value for To property
      */
-    public void setTo(AttributedURIType iri) {
-        to = iri;
+    public void setTo(EndpointReferenceType epr) {
+        to = epr;
     }
 
     /**
@@ -184,7 +188,7 @@
                 buf.append(", ");
             }
             buf.append("To: ");
-            buf.append(to.getValue()); 
+            buf.append(to.getAddress().getValue()); 
         }
         if (null != replyTo) {
             AttributedURIType address = replyTo.getAddress();

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/ContextUtils.java Fri Apr 20 06:40:11 2007
@@ -29,6 +29,7 @@
 import javax.jws.WebMethod;
 import javax.jws.WebService;
 import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBElement;
 import javax.xml.bind.JAXBException;
 import javax.xml.ws.RequestWrapper;
 import javax.xml.ws.ResponseWrapper;
@@ -54,6 +55,7 @@
 import org.apache.cxf.workqueue.OneShotAsyncExecutor;
 import org.apache.cxf.workqueue.SynchronousExecutor;
 import org.apache.cxf.workqueue.WorkQueueManager;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 import static org.apache.cxf.message.Message.ASYNC_POST_RESPONSE_DISPATCH;
 import static org.apache.cxf.message.Message.REQUESTOR_ROLE;
@@ -74,6 +76,9 @@
 
     private static final String WS_ADDRESSING_PACKAGE = 
         PackageUtils.getPackageName(EndpointReferenceType.class);
+    private static final EndpointReferenceType NONE_ENDPOINT_REFERENCE = 
+        EndpointReferenceUtils.getEndpointReference(Names.WSA_NONE_ADDRESS);
+    
     private static final Logger LOG = LogUtils.getL7dLogger(ContextUtils.class);
     
     
@@ -456,7 +461,7 @@
         // partial response that contains appropriate To and ReplyTo
         // properties (i.e. anonymous & none respectively)
         AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
-        maps.setTo(ContextUtils.getAttributedURI(Names.WSA_ANONYMOUS_ADDRESS));
+        maps.setTo(EndpointReferenceUtils.getAnonymousEndpointReference());
         maps.setReplyTo(WSA_OBJECT_FACTORY.createEndpointReferenceType());
         maps.getReplyTo().setAddress(getAttributedURI(Names.WSA_NONE_ADDRESS));
         maps.setAction(getAttributedURI(""));
@@ -747,7 +752,18 @@
         }
         return method;
     }
-    
+
+    public static EndpointReferenceType getNoneEndpointReference() {
+        return NONE_ENDPOINT_REFERENCE;
+    }
+
+    public static void applyReferenceParam(EndpointReferenceType toEpr, JAXBElement<String> el) {
+        if (null == toEpr.getReferenceParameters()) {
+            toEpr.setReferenceParameters(WSA_OBJECT_FACTORY.createReferenceParametersType());
+        }
+        toEpr.getReferenceParameters().getAny().add(el);
+    }
+
     /**
      * Create a Binding specific Message.
      * 

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/MAPAggregator.java Fri Apr 20 06:40:11 2007
@@ -340,10 +340,8 @@
                 }
                 EndpointReferenceType reference = conduit != null
                                                   ? conduit.getTarget()
-                                                  : null;
-                maps.setTo(reference != null 
-                           ? reference.getAddress()
-                           : ContextUtils.getAttributedURI(Names.WSA_NONE_ADDRESS));                
+                                                  : ContextUtils.getNoneEndpointReference();
+                maps.setTo(reference);
             }
 
             // ReplyTo, set if null in MAPs or if set to a generic address
@@ -378,7 +376,7 @@
             maps.exposeAs(inMAPs.getNamespaceURI());
             // To taken from ReplyTo in incoming MAPs
             if (maps.getTo() == null && inMAPs.getReplyTo() != null) {
-                maps.setTo(inMAPs.getReplyTo().getAddress());
+                maps.setTo(inMAPs.getReplyTo());
             }
             // RelatesTo taken from MessageID in incoming MAPs
             if (inMAPs.getMessageID() != null

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/MAPCodec.java Fri Apr 20 06:40:11 2007
@@ -22,6 +22,7 @@
 
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -35,6 +36,7 @@
 import javax.xml.bind.Unmarshaller;
 import javax.xml.namespace.QName;
 
+import org.w3c.dom.Attr;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
@@ -54,9 +56,9 @@
 import org.apache.cxf.ws.addressing.ContextUtils;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.Names;
+import org.apache.cxf.ws.addressing.ReferenceParametersType;
 import org.apache.cxf.ws.addressing.RelatesToType;
-
-
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 
 
 /**
@@ -66,7 +68,8 @@
 public class MAPCodec extends AbstractSoapInterceptor {
 
     private static final Logger LOG = LogUtils.getL7dLogger(MAPCodec.class);
-    
+    private static final String IS_REFERENCE_PARAM_ATTR_NAME = "isReferenceParameter";
+
     /**
      * REVISIT: map usage that the *same* interceptor instance 
      * is used in all chains.
@@ -186,6 +189,7 @@
                                 AttributedURIType.class, 
                                 header, 
                                 marshaller);
+                encodeReferenceParameters(maps, header, marshaller);
                 propogateAction(maps.getAction(), message);
                 applyMAPValidation(message);
             } catch (JAXBException je) {
@@ -193,6 +197,45 @@
             }
         }
     }
+
+    private void encodeReferenceParameters(AddressingProperties maps, Element header, 
+                                           Marshaller marshaller) throws JAXBException {
+        EndpointReferenceType toEpr = maps.getToEndpointReference();
+        if (null != toEpr) {
+            ReferenceParametersType params = toEpr.getReferenceParameters();
+            if (null != params) {
+                for (Object o : params.getAny()) {
+                    if (o instanceof Element || o instanceof JAXBElement) {
+                        JAXBElement jaxbEl = null;
+                        if (o instanceof Element) {
+                            Element e = (Element)o;
+                            QName elQn = new QName(e.getNamespaceURI(), e.getLocalName());
+                            jaxbEl = new JAXBElement<String>(elQn,
+                                String.class, 
+                                e.getTextContent());
+                        } else {
+                            jaxbEl = (JAXBElement) o;
+                        }
+
+                        marshaller.marshal(jaxbEl, header);
+                        Element lastAdded = (Element)header.getLastChild();
+                        addIsReferenceParameterMarkerAttribute(lastAdded);
+                    } else {
+                        LOG.log(Level.WARNING, "IGNORE_NON_ELEMENT_REF_PARAM_MSG", o);
+                    }
+                }
+            }
+        }
+    }
+
+    private void addIsReferenceParameterMarkerAttribute(Element lastAdded) {
+        Attr isRefParamAttr = 
+            lastAdded.getOwnerDocument().createAttributeNS(Names.WSA_NAMESPACE_PREFIX, 
+                                                           IS_REFERENCE_PARAM_ATTR_NAME);
+        isRefParamAttr.setTextContent("1");
+        isRefParamAttr.setPrefix(Names.WSA_NAMESPACE_PREFIX);
+        lastAdded.setAttributeNodeNS(isRefParamAttr);
+    }
     
     /**
      * Encode message in exposed version.
@@ -239,6 +282,7 @@
             if (header != null) {
                 LOG.log(Level.INFO, "Inbound WS-Addressing headers");
                 Unmarshaller unmarshaller = null;
+                Set<Element> referenceParameterHeaders = null;
                 NodeList headerElements = header.getChildNodes();
                 int headerCount = headerElements.getLength();
                 for (int i = 0; i < headerCount; i++) {
@@ -264,11 +308,12 @@
                                                        headerElement, 
                                                        unmarshaller));
                             } else if (Names.WSA_TO_NAME.equals(localName)) {
-                                maps.setTo(decodeAsNative(
+                                AttributedURIType addr = decodeAsNative(
                                                        headerURI,
                                                        AttributedURIType.class,
                                                        headerElement, 
-                                                       unmarshaller));
+                                                       unmarshaller);
+                                maps.setTo(EndpointReferenceUtils.getEndpointReference(addr));
                             } else if (Names.WSA_REPLYTO_NAME.equals(localName)) {
                                 maps.setReplyTo(decodeAsNative(
                                                        headerURI,
@@ -294,13 +339,23 @@
                                                        headerElement, 
                                                        unmarshaller));
                             }
+                        } else if (null != headerElement.getAttribute(IS_REFERENCE_PARAM_ATTR_NAME)) {
+                            if (null == referenceParameterHeaders) {
+                                referenceParameterHeaders = new HashSet<Element>();
+                            }
+                            referenceParameterHeaders.add(headerElement); 
                         } else if (headerURI.contains(Names.WSA_NAMESPACE_PATTERN)) {
                             LOG.log(Level.WARNING, 
                                     "UNSUPPORTED_VERSION_MSG",
                                     headerURI);
                         }
                     }
-                }                
+                }
+                if (null != referenceParameterHeaders) {
+                    decodeReferenceParameters(referenceParameterHeaders, maps, unmarshaller);
+                }
+                restoreExchange(message, maps);
+                markPartialResponse(message, maps);
             }
         } catch (JAXBException je) {
             LOG.log(Level.WARNING, "SOAP_HEADER_DECODE_FAILURE_MSG", je); 
@@ -308,6 +363,19 @@
         return maps;
     }
     
+    private void decodeReferenceParameters(Set<Element> referenceParameterHeaders, 
+                                           AddressingPropertiesImpl maps, 
+                                           Unmarshaller unmarshaller) 
+        throws JAXBException {
+        EndpointReferenceType toEpr = maps.getToEndpointReference();
+        if (null != toEpr) {
+            for (Element e : referenceParameterHeaders) {
+                JAXBElement<String> el = unmarshaller.unmarshal(e, String.class);
+                ContextUtils.applyReferenceParam(toEpr, el);
+            }
+        }
+    }
+
     /**
      * Decodes a MAP from a exposed version.
      *

Modified: incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/Messages.properties
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/Messages.properties?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/Messages.properties (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/main/java/org/apache/cxf/ws/addressing/soap/Messages.properties Fri Apr 20 06:40:11 2007
@@ -21,3 +21,4 @@
 SOAP_HEADER_ENCODE_FAILURE_MSG = WS-Addressing - encoding Message Addressing Properties as SOAP Headers failed:
 SOAP_HEADER_DECODE_FAILURE_MSG = WS-Addressing - decoding Message Addressing Properties from SOAP Headers failed:
 UNSUPPORTED_VERSION_MSG = Unsupported WS-Addressing version {0}
+IGNORE_NON_ELEMENT_REF_PARAM_MSG = Ignoring reference parameter {0} because it is not a JAXBElement

Modified: incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java (original)
+++ incubator/cxf/trunk/rt/ws/addr/src/test/java/org/apache/cxf/ws/addressing/soap/MAPCodecTest.java Fri Apr 20 06:40:11 2007
@@ -51,6 +51,7 @@
 import org.apache.cxf.ws.addressing.RelatesToType;
 import org.apache.cxf.ws.addressing.v200408.AttributedURI;
 import org.apache.cxf.ws.addressing.v200408.Relationship;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
 import org.easymock.IArgumentMatcher;
 import org.easymock.classextension.EasyMock;
 import org.easymock.classextension.IMocksControl;
@@ -427,7 +428,8 @@
         maps.setMessageID(id);
         AttributedURIType to =
             ContextUtils.getAttributedURI("foobar");
-        maps.setTo(to);
+        EndpointReferenceType toEpr = EndpointReferenceUtils.getEndpointReference(to);
+        maps.setTo(toEpr);
         EndpointReferenceType replyTo = new EndpointReferenceType();
         String anonymous = 
             exposeAsNative

Modified: incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/main/java/org/apache/cxf/ws/rm/Proxy.java Fri Apr 20 06:40:11 2007
@@ -217,14 +217,15 @@
                 public Conduit selectConduit(Message message) {
                     Conduit conduit = null;
                     EndpointInfo endpointInfo = getEndpoint().getEndpointInfo();
-                    String originalAddress = endpointInfo.getAddress();
+                    org.apache.cxf.ws.addressing.EndpointReferenceType original = 
+                        endpointInfo.getTarget();
                     try {
                         if (null != address) {
-                            endpointInfo.setAddress(address.getAddress().getValue());
+                            endpointInfo.setAddress(address);
                         }
                         conduit = super.selectConduit(message);
                     } finally {
-                        endpointInfo.setAddress(originalAddress);
+                        endpointInfo.setAddress(original);
                     }
                     return conduit;
                 }

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/ProxyTest.java Fri Apr 20 06:40:11 2007
@@ -38,7 +38,6 @@
 import org.apache.cxf.service.model.ServiceInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.workqueue.SynchronousExecutor;
-import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.RelatesToType;
 import org.apache.cxf.ws.addressing.v200408.AttributedURI;
 import org.apache.cxf.ws.addressing.v200408.EndpointReferenceType;
@@ -248,15 +247,7 @@
         Proxy.RMClient client = proxy.new RMClient(bus, endpoint, conduit, address);
         EndpointInfo endpointInfo = control.createMock(EndpointInfo.class);
         EasyMock.expect(endpoint.getEndpointInfo()).andReturn(endpointInfo).anyTimes();
-        String oa = "oa";
-        EasyMock.expect(endpointInfo.getAddress()).andReturn(oa);
-        AttributedURIType uri = control.createMock(AttributedURIType.class);
-        EasyMock.expect(address.getAddress()).andReturn(uri);
-        String ta = "ta";
-        EasyMock.expect(uri.getValue()).andReturn(ta);
-        endpointInfo.setAddress(ta);
-        EasyMock.expectLastCall();
-        endpointInfo.setAddress(oa);
+        endpointInfo.setAddress(address);
         EasyMock.expectLastCall();
         control.replay();
         assertSame(conduit, client.getConduit());    

Modified: incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java?view=diff&rev=530804&r1=530803&r2=530804
==============================================================================
--- incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java (original)
+++ incubator/cxf/trunk/rt/ws/rm/src/test/java/org/apache/cxf/ws/rm/RMOutInterceptorTest.java Fri Apr 20 06:40:11 2007
@@ -30,7 +30,6 @@
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.phase.PhaseInterceptorChain;
 import org.apache.cxf.ws.addressing.AddressingPropertiesImpl;
-import org.apache.cxf.ws.addressing.AttributedURIType;
 import org.apache.cxf.ws.addressing.EndpointReferenceType;
 import org.apache.cxf.ws.addressing.JAXWSAConstants;
 import org.apache.cxf.ws.addressing.MAPAggregator;
@@ -124,14 +123,7 @@
     
     private AddressingPropertiesImpl createMAPs(String action, String to, String replyTo) {
         AddressingPropertiesImpl maps = new AddressingPropertiesImpl();
-        org.apache.cxf.ws.addressing.ObjectFactory factory = 
-            new org.apache.cxf.ws.addressing.ObjectFactory();
-        AttributedURIType uri = factory.createAttributedURIType();
-        uri.setValue(action);
-        maps.setAction(uri);
-        uri = factory.createAttributedURIType();
-        uri.setValue(to);
-        maps.setTo(uri);
+        maps.setTo(RMUtils.createReference(to));
         EndpointReferenceType epr = RMUtils.createReference(replyTo);
         maps.setReplyTo(epr);
         return maps;

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java?view=auto&rev=530804
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java Fri Apr 20 06:40:11 2007
@@ -0,0 +1,63 @@
+/**
+ * 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.systest.factory_pattern;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.ws.addressing.EndpointReferenceType;
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+@WebService(serviceName = "NumberFactoryService", 
+            portName = "NumberFactoryPort", 
+            endpointInterface = "org.apache.cxf.factory_pattern.NumberFactory", 
+            targetNamespace = "http://cxf.apache.org/factory_pattern")
+public class HttpNumberFactoryImpl extends NumberFactoryImpl {
+
+    public HttpNumberFactoryImpl() {
+        super();
+        // do servant creation up front so manual epr creation test has endpoint to talk to.
+        // the manual epr will not come from create()
+        //
+        manageNumberServantInitialisation();
+    }
+    
+    public EndpointReferenceType create(String id) {
+        String portName = null;
+        return EndpointReferenceUtils.getEndpointReferenceWithId(NUMBER_SERVICE_QNAME, 
+                                                                 portName, 
+                                                                 id,
+                                                                 BusFactory.getDefaultBus());
+    }
+
+    protected void initDefaultServant() {
+        servant = new HttpNumberImpl();
+
+        String wsdlLocation = "testutils/factory_pattern.wsdl";
+        String bindingId = null;
+        EndpointImpl ep = 
+            new EndpointImpl(BusFactory.getDefaultBus(), servant, bindingId, wsdlLocation);
+        ep.setEndpointName(new QName(NUMBER_SERVICE_QNAME.getNamespaceURI(), "NumberPort"));
+        ep.publish();
+        templateEpr = ep.getServer().getDestination().getAddress();        
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java
URL: http://svn.apache.org/viewvc/incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java?view=auto&rev=530804
==============================================================================
--- incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java (added)
+++ incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java Fri Apr 20 06:40:11 2007
@@ -0,0 +1,43 @@
+/**
+ * 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.systest.factory_pattern;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+import javax.xml.ws.handler.MessageContext;
+
+import org.apache.cxf.wsdl.EndpointReferenceUtils;
+
+@WebService(serviceName = "NumberService", 
+            endpointInterface = "org.apache.cxf.factory_pattern.Number", 
+            targetNamespace = "http://cxf.apache.org/factory_pattern")
+public class HttpNumberImpl extends NumberImpl {
+    @Resource
+    protected WebServiceContext aContext;
+
+    protected WebServiceContext getWebSercviceContext() {
+        return aContext;
+    }
+
+    protected String idFromMessageContext(MessageContext mc) {
+        return EndpointReferenceUtils.getEndpointReferenceId(mc);
+    }
+}

Propchange: incubator/cxf/trunk/systests/src/test/java/org/apache/cxf/systest/factory_pattern/HttpNumberImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message