You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/09/16 09:11:47 UTC

svn commit: r576055 - in /incubator/tuscany/java/sca/modules: binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/ binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/ core-spi/src/main/java/org/apache/tusca...

Author: rfeng
Date: Sun Sep 16 00:11:45 2007
New Revision: 576055

URL: http://svn.apache.org/viewvc?rev=576055&view=rev
Log:
Apply the patch from Simon Nash for TUSCANY-1706

Modified:
    incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
    incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
    incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
    incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java

Modified: incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-sca-axis2/src/main/java/org/apache/tuscany/sca/binding/sca/axis2/impl/Axis2SCABindingInvoker.java Sun Sep 16 00:11:45 2007
@@ -58,34 +58,38 @@
 
         // make sure that the epr of the target service is set in the TO
         // field of the message
-        EndpointReference ep = msg.getTo();
+        EndpointReference to = msg.getTo();
 
         // check to see if we either don't have an endpoint set or if the uri 
         // is dynamic or the target service is marked as unresolved
-        if ((ep == null) || (ep.getURI().equals("/") || (ep.getContract() == null) || (ep.getContract().isUnresolved()))) {
+        if ((to == null) || (to.getURI().equals("/") || (to.getContract() == null) || (to.getContract().isUnresolved()))) {
 
-            EndpointReference serviceEPR = provider.getServiceEndpoint();
+            EndpointReference eprTo = provider.getServiceEndpoint();
 
-            if (serviceEPR == null) {
+            if (eprTo == null) {
                 throw new ServiceUnavailableException("Endpoint for service: " + provider.getSCABinding().getURI()
                     + " can't be found for component: "
                     + provider.getComponent().getName()
                     + " reference: "
                     + provider.getComponentReference().getName());
             }
-            msg.setTo(serviceEPR);
+            if (to != null) {
+                to.mergeEndpoint(eprTo);
+            } else {
+                msg.setTo(eprTo);
+            }
         }
 
         // make sure that the epr of the callback service (if there is one) is set
-        // in the from/callback field of the message. 
-        ep = msg.getFrom();
+        // in the callbackReference field of the message. 
+        EndpointReference callbackEPR = msg.getTo().getReferenceParameters().getCallbackReference();
 
-        if ((ep == null) || (ep.getURI().equals("/"))) {
+        if ((callbackEPR == null) || (callbackEPR.getURI().equals("/"))) {
 
-            EndpointReference callbackEPR = provider.getCallbackEndpoint();
+            callbackEPR = provider.getCallbackEndpoint();
 
             if (callbackEPR != null) {
-                ep.setCallbackEndpoint(callbackEPR);
+                msg.getTo().getReferenceParameters().setCallbackReference(callbackEPR);
             }
         }
 

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2BindingInvoker.java Sun Sep 16 00:11:45 2007
@@ -58,6 +58,7 @@
     public static final QName QNAME_WSA_TO =
         new QName(AddressingConstants.Final.WSA_NAMESPACE, AddressingConstants.WSA_TO);
 
+    public static final QName CALLBACK_REFERENCE_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackReference");
     public static final QName CALLBACK_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "CallbackID");
     public static final QName CONVERSATION_ID_REFPARM_QN = new QName(Constants.SCA10_TUSCANY_NS, "ConversationID");
 
@@ -147,6 +148,10 @@
         }
 
         // set callback endpoint and callback ID for WS-Addressing header
+        if (parameters.getCallbackReference() != null) {
+            toEPR.addReferenceParameter(CALLBACK_REFERENCE_REFPARM_QN,
+                                        parameters.getCallbackReference().getBinding().getURI());
+        }
         if (parameters.getCallbackID() != null) {
             //FIXME: serialize callback ID to XML in case it is not a string
             toEPR.addReferenceParameter(CALLBACK_ID_REFPARM_QN, parameters.getCallbackID().toString());
@@ -160,35 +165,18 @@
             toEPR.addReferenceParameter(CONVERSATION_ID_REFPARM_QN, conversationId.toString());
         }
 
-        EndpointReference fromEPR = null;
-        if (msg.getFrom().getCallbackEndpoint() != null) {
-            fromEPR = new EndpointReference(msg.getFrom().getCallbackEndpoint().getBinding().getURI());
-        }
-
         // add WS-Addressing header
         //FIXME: is there any way to use the Axis2 addressing support for this?
-        if (toEPR != null || fromEPR != null) {
+        if (toEPR != null) {
             SOAPEnvelope sev = requestMC.getEnvelope();
             SOAPHeader sh = sev.getHeader();
-            if (toEPR != null) {
-                OMElement epr =
-                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
-                                                 toEPR,
-                                                 QNAME_WSA_TO,
-                                                 AddressingConstants.Final.WSA_NAMESPACE);
-                sh.addChild(epr);
-                requestMC.setTo(toEPR);
-            }
-            if (fromEPR != null) {
-                OMElement epr =
-                    EndpointReferenceHelper.toOM(sev.getOMFactory(),
-                                                 fromEPR,
-                                                 QNAME_WSA_FROM,
-                                                 AddressingConstants.Final.WSA_NAMESPACE);
-                sh.addChild(epr);
-                requestMC.setFrom(fromEPR);
-            }
-
+            OMElement epr =
+                EndpointReferenceHelper.toOM(sev.getOMFactory(),
+                                             toEPR,
+                                             QNAME_WSA_TO,
+                                             AddressingConstants.Final.WSA_NAMESPACE);
+            sh.addChild(epr);
+            requestMC.setTo(toEPR);
         }
 
         operationClient.addMessageContext(requestMC);

Modified: incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java (original)
+++ incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/Axis2ServiceProvider.java Sun Sep 16 00:11:45 2007
@@ -71,6 +71,7 @@
 import org.apache.tuscany.sca.interfacedef.Interface;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.policy.PolicySet;
 import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
@@ -399,6 +400,13 @@
                             conversationID = convIDElement.getText();
                         }
                     }
+                    OMElement callbackAddrElement =
+                        params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_REFERENCE_REFPARM_QN);
+                    if (callbackAddrElement != null) {
+                        if (contract.getInterfaceContract().getCallbackInterface() != null) {
+                            callbackAddress = callbackAddrElement.getText();
+                        }
+                    }
                     OMElement callbackIDElement =
                         params.getFirstChildWithName(Axis2BindingInvoker.CALLBACK_ID_REFPARM_QN);
                     if (callbackIDElement != null) {
@@ -408,36 +416,35 @@
                     }
                 }
             }
-
-            OMElement from = header.getFirstChildWithName(QNAME_WSA_FROM);
-            if (from != null) {
-                OMElement addrElement = from.getFirstChildWithName(QNAME_WSA_ADDRESS);
-                if (addrElement != null && contract.getInterfaceContract().getCallbackInterface() != null) {
-                    callbackAddress = addrElement.getText();
-                }
-            }
         }
 
-        RuntimeWire wire = null;
-        try {
-            wire = (RuntimeWire)(((RuntimeComponentService)contract).getRuntimeWire(getBinding())).clone();
-        } catch (CloneNotSupportedException e) {
-            // Should not happen
+        // create a message object and set the args as its body
+        Message msg = messageFactory.createMessage();
+        msg.setBody(args);
+
+        // if reference parameters are needed, create a new "To" EPR to hold them
+        EndpointReference to = null;
+        if (callbackAddress != null ||
+            callbackID != null ||
+            conversationID != null) {
+            to = new EndpointReferenceImpl(null);
+            msg.setTo(to);
         }
-        EndpointReference source = wire.getSource();
+
+        // set the reference parameters into the "To" EPR
         if (callbackAddress != null) {
-            source.setCallbackEndpoint(new EndpointReferenceImpl(callbackAddress));
+            to.getReferenceParameters().setCallbackReference(new EndpointReferenceImpl(callbackAddress));
         }
-
-        EndpointReference to = wire.getTarget();
         if (callbackID != null) {
             to.getReferenceParameters().setCallbackID(callbackID);
         }
         if (conversationID != null) {
             to.getReferenceParameters().setConversationID(conversationID);
         }
-        return wire.invoke(op, args);
 
+        // find the runtime wire and invoke it with the message
+        RuntimeWire wire = ((RuntimeComponentService)contract).getRuntimeWire(getBinding());
+        return wire.invoke(op, msg);
     }
 
     public boolean isConversational() {

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/EndpointReference.java Sun Sep 16 00:11:45 2007
@@ -87,5 +87,7 @@
     
     void setReferenceParameters(ReferenceParameters parameters);
     ReferenceParameters getReferenceParameters();
+
+    void mergeEndpoint(EndpointReference epr);
     
 }

Modified: incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java (original)
+++ incubator/tuscany/java/sca/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/RuntimeWire.java Sun Sep 16 00:11:45 2007
@@ -24,6 +24,7 @@
 
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Message;
 
 /**
  * The runtime wire interface that connects a component reference to a 
@@ -76,12 +77,21 @@
     
     /**
      * Invoke an operation with given arguments
-     * @param operation
+     * @param operation The operation
      * @param args The arguments
      * @return The result
      * @throws InvocationTargetException
      */
     Object invoke(Operation operation, Object[] args) throws InvocationTargetException;
+
+    /**
+     * Invoke an operation with a context message
+     * @param operation The operation
+     * @param msg The message
+     * @return The result
+     * @throws InvocationTargetException
+     */
+    Object invoke(Operation operation, Message msg) throws InvocationTargetException;
 
     /**
      * @return a clone of the runtime wire

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/EndpointReferenceImpl.java Sun Sep 16 00:11:45 2007
@@ -171,4 +171,14 @@
     public void setReferenceParameters(ReferenceParameters parameters) {
         this.parameters = parameters;
     }
+
+    public void mergeEndpoint(EndpointReference epr) {
+        this.component = epr.getComponent();
+        this.contract = epr.getContract();
+        this.binding = epr.getBinding();
+        this.interfaceContract = epr.getInterfaceContract();
+        this.uri = epr.getURI();
+        this.callbackEndpoint = epr.getCallbackEndpoint();
+    }
+   
 }

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/assembly/RuntimeWireImpl.java Sun Sep 16 00:11:45 2007
@@ -37,6 +37,7 @@
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
 import org.apache.tuscany.sca.provider.ImplementationProvider;
 import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
@@ -117,7 +118,14 @@
     }
 
     public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
-        return invoker.invoke(operation, args);
+        Message msg = messageFactory.createMessage();
+        msg.setBody(args);
+        msg.setTo(wireTarget);
+        return invoker.invoke(operation, msg);
+    }
+
+    public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+        return invoker.invoke(operation, msg);
     }
 
     /**

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackWireObjectFactory.java Sun Sep 16 00:11:45 2007
@@ -72,8 +72,8 @@
     }
 
     public RuntimeWire selectCallbackWire(Message msgContext) {
-        EndpointReference from = msgContext.getFrom();
-        if (from == null) {
+        EndpointReference callbackEPR = getCallbackEndpoint(msgContext);
+        if (callbackEPR == null) {
             return null;
         }
 
@@ -82,7 +82,7 @@
 
         // first choice is wire with matching destination endpoint
         for (RuntimeWire wire : wires) {
-            if (from.getURI().equals(wire.getTarget().getURI())) {
+            if (callbackEPR.getURI().equals(wire.getTarget().getURI())) {
                 try {
                     return (RuntimeWire)wire.clone();
                 } catch (CloneNotSupportedException e) {

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKCallbackInvocationHandler.java Sun Sep 16 00:11:45 2007
@@ -28,6 +28,7 @@
 import org.apache.tuscany.sca.invocation.InvocationChain;
 import org.apache.tuscany.sca.invocation.Message;
 import org.apache.tuscany.sca.invocation.MessageFactory;
+import org.apache.tuscany.sca.runtime.EndpointReference;
 import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
 import org.apache.tuscany.sca.runtime.RuntimeWire;
 import org.osoa.sca.NoRegisteredCallbackException;
@@ -93,7 +94,8 @@
         callbackID = msgContext.getTo().getReferenceParameters().getCallbackID();
         ((CallbackWireObjectFactory)callableReference).attachCallbackID(callbackID);
 
-        setEndpoint(msgContext.getFrom().getCallbackEndpoint());
+        EndpointReference epr = msgContext.getTo().getReferenceParameters().getCallbackReference();
+        setEndpoint(epr);
 
         // need to set the endpoint on the binding also so that when the chains are created next
         // the sca binding can decide whether to provide local or remote invokers. 
@@ -101,7 +103,7 @@
         //        binding that may possibly be trying to point at two things in the multi threaded 
         //        case. Need to confirm the general model here and how the clone and bind part
         //        is intended to work
-        wire.getSource().getBinding().setURI(msgContext.getFrom().getCallbackEndpoint().getURI());
+        wire.getSource().getBinding().setURI(epr.getURI());
 
         // also need to set the target contract as it varies for the sca binding depending on 
         // whether it is local or remote

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/JDKInvocationHandler.java Sun Sep 16 00:11:45 2007
@@ -278,7 +278,6 @@
                 EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                 parameters.setCallbackReference(callbackRef);
             } else {
-                parameters.setCallbackReference(wire.getSource().getCallbackEndpoint());
                 if (interfaze != null) {
                     if (!interfaze.isConversational()) {
                         throw new IllegalArgumentException(

Modified: incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java?rev=576055&r1=576054&r2=576055&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java (original)
+++ incubator/tuscany/java/sca/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/RuntimeWireInvoker.java Sun Sep 16 00:11:45 2007
@@ -79,29 +79,33 @@
         }
     }
 
-    public Object invoke(Operation operation, Object[] args) throws InvocationTargetException {
-        return invoke(wire, operation, args);
+    public Object invoke(Operation operation, Message msg) throws InvocationTargetException {
+        return invoke(wire, operation, msg);
     }
 
-    public Object invoke(RuntimeWire wire, Operation operation, Object[] args) throws InvocationTargetException {
+    public Object invoke(RuntimeWire wire, Operation operation, Message msg) throws InvocationTargetException {
         RuntimeWire runtimeWire = wire == null ? this.wire : wire;
         InvocationChain chain = runtimeWire.getInvocationChain(operation);
-        return invoke(chain, args, runtimeWire);
+        return invoke(chain, msg, runtimeWire);
     }
 
-    protected Object invoke(InvocationChain chain, Object[] args, RuntimeWire wire) throws InvocationTargetException {
+    protected Object invoke(InvocationChain chain, Message msg, RuntimeWire wire) throws InvocationTargetException {
 
-        Message msg = messageFactory.createMessage();
         msg.setFrom(wire.getSource());
+        EndpointReference epTo = null;
         if (endpoint != null) {
-            msg.setTo(endpoint);
+            epTo = endpoint;
         } else {
-            msg.setTo(wire.getTarget());
+            epTo = wire.getTarget();
+        }
+        if (msg.getTo() != null) {
+            msg.getTo().mergeEndpoint(epTo);
+        } else {
+            msg.setTo(epTo);
         }
         Invoker headInvoker = chain.getHeadInvoker();
         Operation operation = chain.getTargetOperation();
         msg.setOperation(operation);
-        msg.setBody(args);
 
         Message msgContext = ThreadMessageContext.getMessageContext();
         Object currentConversationID = msgContext.getTo().getReferenceParameters().getConversationID();
@@ -176,7 +180,6 @@
                 EndpointReference callbackRef = ((CallableReferenceImpl)callbackObject).getEndpointReference();
                 parameters.setCallbackReference(callbackRef);
             } else {
-                parameters.setCallbackReference(wire.getSource().getCallbackEndpoint());
                 if (interfaze != null) {
                     if (!interfaze.isConversational()) {
                         throw new IllegalArgumentException(



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