tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1242412 - in /tuscany/sca-java-2.x/trunk: modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/ modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/ modules/binding-jms-runtime...
Date Thu, 09 Feb 2012 17:46:51 GMT
Author: slaws
Date: Thu Feb  9 17:46:50 2012
New Revision: 1242412

URL: http://svn.apache.org/viewvc?rev=1242412&view=rev
Log:
TUSCANY-4011 - stop the SCDL callback binding configuration from being overwritten. The JMS binding strangely relied on this so required some surgery. I've also simplified CallbackServiceReference and added a CALLBACK message header and CallbackHandler object to make is simpler to pass the callback address down the message chain. The existing approach of creating a CallbackEndpoint model is still supported at the moment. 

Added:
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackHandler.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml
Modified:
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
    tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/Constants.java
    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java
    tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite
    tuscany/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/host/DefaultJMSServiceListenerFactory.java Thu Feb  9 17:46:50 2012
@@ -43,10 +43,8 @@ public class DefaultJMSServiceListenerFa
             
             RuntimeComponentService service = (RuntimeComponentService) jmsSLD.getEndpoint().getService();
             MessageListener listener = new DefaultServiceInvoker(jmsSLD.getEndpoint(), jmsSLD.getTargetBinding(), jmsSLD.getMessageFactory(), rf);
-
-//            return new ASFListener(listener, service.getName(), service.isCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
-// TODO: 2.x migration, service.isCallback()             
-            return new DefaultJMSServiceListener(listener, service.getName(), false, jmsSLD.getJmsBinding(), workScheduler, rf);
+           
+            return new DefaultJMSServiceListener(listener, service.getName(), service.isForCallback(), jmsSLD.getJmsBinding(), workScheduler, rf);
 
         } catch (NamingException e) {
             throw new JMSBindingException(e);

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/provider/RRBJMSBindingInvoker.java Thu Feb  9 17:46:50 2012
@@ -29,6 +29,8 @@ import org.apache.tuscany.sca.binding.jm
 import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
 import org.apache.tuscany.sca.binding.jms.JMSBindingException;
 import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.core.invocation.CallbackHandler;
+import org.apache.tuscany.sca.core.invocation.Constants;
 import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.util.FaultException;
@@ -274,6 +276,13 @@ public class RRBJMSBindingInvoker extend
             if (tuscanyMsg.getFrom().getTargetEndpoint() != null) {
                 if (tuscanyMsg.getFrom().getTargetEndpoint().getBinding() != null) {
                     this.jmsBinding = (JMSBinding)tuscanyMsg.getFrom().getTargetEndpoint().getBinding();
+                    
+/* TUSCANY-4011 - we could delay until this point until setting the callback destination                    
+                    CallbackHandler callbackHandler = (CallbackHandler)tuscanyMsg.getHeaders().get(Constants.CALLBACK);
+                    if (callbackHandler != null && callbackHandler.getCallbackTargetURI() != null){
+                        this.jmsBinding.setDestinationName(callbackHandler.getCallbackTargetURI());
+                    }
+*/                    
                     requestDestination = lookupDestination();
                 }
             }

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/transport/TransportServiceInterceptor.java Thu Feb  9 17:46:50 2012
@@ -126,11 +126,6 @@ public class TransportServiceInterceptor
             from.setTargetEndpoint(fromEndpoint);
             from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
             msg.setFrom(from);
-            Endpoint callbackEndpoint = assemblyFactory.createEndpoint();
-            // binding is set into the callback endpoint in the CallbackDesitnationInterceptor           
-            callbackEndpoint.setUnresolved(true);
-            from.setCallbackEndpoint(callbackEndpoint);
-
             return msg;
 
     } // end method invokeRequest

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms-runtime/src/main/java/org/apache/tuscany/sca/binding/jms/wire/CallbackDestinationInterceptor.java Thu Feb  9 17:46:50 2012
@@ -27,6 +27,8 @@ import org.apache.tuscany.sca.binding.jm
 import org.apache.tuscany.sca.binding.jms.JMSBindingConstants;
 import org.apache.tuscany.sca.binding.jms.JMSBindingException;
 import org.apache.tuscany.sca.binding.jms.context.JMSBindingContext;
+import org.apache.tuscany.sca.core.invocation.CallbackHandler;
+import org.apache.tuscany.sca.core.invocation.Constants;
 import org.apache.tuscany.sca.core.invocation.InterceptorAsyncImpl;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
@@ -81,15 +83,20 @@ public class CallbackDestinationIntercep
                 if (!callbackdestName.startsWith("jms:jndi:")) {
                     throw new JMSBindingException("message property " + JMSBindingConstants.CALLBACK_Q_PROPERTY + " does not start with 'jms:jndi:' found: " + callbackdestName);
                 } else {
-                    callbackdestName = callbackdestName.substring(9);
-                } // end if
+                    callbackdestName = "jms:queue:" + callbackdestName.substring(9);
+                } 
             } else {
             	// If there is no Callback destination name header present, but the service is a callback, use the JMS ReplyTo header
+                // as per the spec this will override anything specified by the user in SCDL
                 if (service.getInterfaceContract().getCallbackInterface() != null) {
                     if ( ( jmsMsg.getJMSReplyTo() != null ) && msg.getOperation().isNonBlocking() ) {
                     	Destination replyTo = jmsMsg.getJMSReplyTo();
                     	if (replyTo != null) {
-                    		callbackdestName = (replyTo instanceof Queue) ? ((Queue) replyTo).getQueueName() : ((Topic) replyTo).getTopicName();
+                    	    if (replyTo instanceof Queue){
+                    	        callbackdestName = "jms:queue:" + ((Queue) replyTo).getQueueName();
+                    	    } else {
+                    	        callbackdestName = "jms:topic:" + ((Topic) replyTo).getTopicName();
+                    	    }
                    	   	}
                     } // end if
                 } // end if
@@ -97,22 +104,7 @@ public class CallbackDestinationIntercep
                 
             // Place the Callback destination name into the Callback EPRs for the service endpoint
             if (callbackdestName != null) {
-                for (Binding b : service.getCallback().getBindings()) {
-                    if (b instanceof JMSBinding) {
-                        JMSBinding callbackBinding;
-                        try {
-                            callbackBinding = (JMSBinding)((JMSBinding)b).clone();
-                        } catch (CloneNotSupportedException e) {
-                            throw new RuntimeException(e);
-                        }
-                        callbackBinding.setDestinationName(callbackdestName);
-                        // the "from" EPR model is created in the TransportServiceInterceptor
-                        // not sure which this destination calculation is not performed
-                        // there as well
-                        msg.getFrom().getCallbackEndpoint().setBinding(callbackBinding);
-//                        msg.getHeaders().put("CALLBACK_BINDING", callbackBinding);
-                    }
-                }
+                msg.getHeaders().put(Constants.CALLBACK, new CallbackHandler(callbackdestName));             
             } // end if  
 
 // Callback ID not used at present            

Modified: tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/JMSBinding.java Thu Feb  9 17:46:50 2012
@@ -24,6 +24,7 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.TreeSet;
 
 import javax.xml.namespace.QName;
@@ -35,6 +36,9 @@ import org.apache.tuscany.sca.assembly.E
 import org.apache.tuscany.sca.assembly.OperationSelector;
 import org.apache.tuscany.sca.assembly.OperationsConfigurator;
 import org.apache.tuscany.sca.assembly.WireFormat;
+import org.apache.tuscany.sca.monitor.Monitor;
+import org.apache.tuscany.sca.monitor.Problem;
+import org.apache.tuscany.sca.monitor.Problem.Severity;
 import org.apache.tuscany.sca.policy.ExtensionType;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.PolicySet;
@@ -180,6 +184,11 @@ public class JMSBinding implements Bindi
 
     public void setURI(String uri) {
         this.uri = uri;
+        if (uri != null){
+            parseURI(uri);
+        } else {
+            setDestinationName(null);
+        }     
     }
 
     public String getName() {
@@ -1108,5 +1117,52 @@ public class JMSBinding implements Bindi
     public List<Extension> getAttributeExtensions() {
         return attributeExtensions;
     }
+    
+    public void parseURI(String uri) {
+        JMSBinding jmsBinding = this; 
+        if (uri == null ||
+            !(uri.startsWith("jms:jndi:") || uri.startsWith("jms:queue:") || uri.startsWith("jms:topic:"))) {
+            return;
+        }      
+        
+        int i = uri.indexOf('?');            
+        if (i >= 0) {
+            StringTokenizer st = new StringTokenizer(uri.substring(i+1),"&");
+            while (st.hasMoreTokens()) {
+                String s = st.nextToken();
+                if (s.startsWith("jndiConnectionFactoryName=")) {
+                    jmsBinding.setConnectionFactoryName(s.substring(26));
+                    } else if (s.startsWith("deliveryMode=")) {
+                        jmsBinding.setURIJMSDeliveryMode("persistent".equals(s.substring(13)));
+                    } else if (s.startsWith("priority=")) {
+                        jmsBinding.setURIJMSPriority(Integer.parseInt(s.substring(9)));
+                    } else if (s.startsWith("timeToLive=")) {
+                        jmsBinding.setURIJMSTimeToLive(Long.parseLong(s.substring(11)));
+                    } else if (s.startsWith("selector='")) {
+                        String selector = s.substring(10);
+                        if (selector.startsWith("\"") || selector.startsWith("'")) {
+                            selector = selector.substring(1, selector.length());
+                        }
+                        if (selector.endsWith("\"") || selector.endsWith("'")) {
+                            selector = selector.substring(0, selector.length() - 1);
+                        }
+                        jmsBinding.setURIJMSSelector(selector);
+                    } else if (s.startsWith("type")) {
+                        String type = s.substring(5);
+                        jmsBinding.setJMSURIType(type);                     
+                    } else {
+                        return;
+                    }
+                }
+            int j=uri.indexOf(':', 4);
+            jmsBinding.setDestinationName(uri.substring(j+1, i));
+            jmsBinding.setDestinationType(uri.substring(4, j));
+        } else {
+           int j=uri.indexOf(':', 4);
+           jmsBinding.setDestinationName(uri.substring(j+1));
+           jmsBinding.setDestinationType(uri.substring(4, j));
+        }
+        jmsBinding.setJMSURI(uri);
+    }
 	
 }

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/context/impl/CallbackServiceReferenceImpl.java Thu Feb  9 17:46:50 2012
@@ -18,8 +18,9 @@
  */
 package org.apache.tuscany.sca.core.context.impl;
 
-import java.net.URI;
 import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.Endpoint;
@@ -29,28 +30,86 @@ import org.apache.tuscany.sca.assembly.b
 import org.apache.tuscany.sca.assembly.builder.BuilderContext;
 import org.apache.tuscany.sca.context.CompositeContext;
 import org.apache.tuscany.sca.context.ThreadMessageContext;
+import org.apache.tuscany.sca.core.invocation.CallbackHandler;
 import org.apache.tuscany.sca.core.invocation.Constants;
 import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
 import org.apache.tuscany.sca.runtime.RuntimeEndpointReference;
 import org.oasisopen.sca.ServiceRuntimeException;
 
+/**
+ * Represent the reference to the callback service. This class basically wraps a Tuscany EndpointReference. 
+ * The callback EPR is selected based on the are 3 basic scenarios we are trying to cater for
+ * 
+ * A/ <component name="MyComponent">
+ *        <service name="MyService>
+ *            blank OR <binding.sca/> 
+ *        </service>
+ *    </component>
+ *    
+ * B/ <component name="MyComponent">
+ *        <service name="MyService>
+ *            <binding.someremotebinding/> 
+ *        </service>
+ *    </component>
+ *    
+ * C/ <component name="MyComponent">
+ *        <service name="MyService>
+ *            some binding
+ *            <callback>
+ *                <binding.someremotebinding/> 
+ *            </callback>
+ *        </service>
+ *    </component>    
+ *    
+ *  A - the callback binding will default to binding.sca and the expectation is that 
+ *      the callback endpoint will be established by looking it up in the registry
+ *      hence the forward call must contain the SCA target name referring to the 
+ *      callback service
+ *      
+ *  B - the callback binding defaults to be the forward binding taking all of its
+ *      configuration. The callback target URI is taken from the forward message and 
+ *      put into the callback binding URI
+ *      
+ *  C - the callback binding is as specified by the user. If the user has not specified
+ *      a binding URI then the URI from the forward message will be placed in the 
+ *      callback binding URI. This may or may not lead to happiness depending on whether
+ *      the forward and callback bindings are compatible
+ *      
+ *  The callback proxy, and this class, is instantiated whenever a new callback proxy is 
+ *  required as follows:
+ *  
+ *    If the service component implementation is STATELESS then each incoming message  
+ *    creates a new service instance and hence a new set of callback proxies
+ *    
+ *    If the service component implementation is COMPOSITE then only a single instance
+ *    of the component implementation will exist and the callback proxy will be retrieved
+ *    via the RequestContext. 
+ *   
+ *  Following the Tuscany runtime model for normal references we don't cache callback 
+ *  proxies across component implementation instances. Hence there will be one
+ *  instance of this class for each callback proxy, however created, and the class
+ *  will refer to a single callback service. To put it another way, messages from 
+ *  multiple clients (presenting different callback services) will be called back to
+ *  via different callback proxies and hence a single instance of this class will 
+ *  not be required to handle more than one callback address.  
+ * 
+ */
 public class CallbackServiceReferenceImpl<B> extends ServiceReferenceImpl<B> {
+    private static final Logger logger = Logger.getLogger(CallbackServiceReferenceImpl.class.getName());
     private RuntimeEndpointReference callbackEPR;
     private List<? extends EndpointReference> callbackEPRs;
     private Endpoint resolvedEndpoint;
     // Holds the ID of the Message that caused the creation of this CallbackServiceReference
     private String msgID;
-
-    /** 
-     * Gets the message ID associated with this callback reference
-     * @return the message ID
-     */
-    public String getMsgID() {
-		return msgID;
-	}
+    
+    // Holds the URI of the target callback service from the Message that caused the 
+    // creation of this CallbackServiceReference
+    private CallbackHandler callbackHandler;
 
 	/*
      * Public constructor for Externalizable serialization/deserialization
+     * TODO - we need to serialize the msgID and callbackURI
      */
     public CallbackServiceReferenceImpl() {
         super();
@@ -60,9 +119,69 @@ public class CallbackServiceReferenceImp
                                         List<? extends EndpointReference> callbackEPRs) {
         super(interfaze, null, getCompositeContext(callbackEPRs));
         this.callbackEPRs = callbackEPRs;
-        init();
+        
+        Message msgContext = ThreadMessageContext.getMessageContext();
+        
+        // Capture the Message ID from the message which caused the creation of this 
+        // CallBackServiceReference
+        this.msgID = (String) msgContext.getHeaders().get(Constants.MESSAGE_ID);
+        
+        // Capture the callback URI from the message which caused the creation of this 
+        // CallBackServiceReference. This code is more complex that needs be for the time being
+        // to cater for bindings that still use the approach of constructing a callback endpoint
+        // to model the callback URI. With these changes the binding can just set a CallbackHandler
+        // in the forward message to get the same effect. Some bindings don't do that hence
+        // the various checks
+        this.resolvedEndpoint = msgContext.getFrom().getCallbackEndpoint();
+        if (resolvedEndpoint != null && resolvedEndpoint.getBinding() != null){
+            if (resolvedEndpoint.getBinding().getType().equals(SCABinding.TYPE)){
+                this.callbackHandler = new CallbackHandler(resolvedEndpoint.getURI());
+            } else {
+                this.callbackHandler = new CallbackHandler(resolvedEndpoint.getBinding().getURI());
+            }
+        } else { 
+            this.callbackHandler = (CallbackHandler)msgContext.getHeaders().get(Constants.CALLBACK);
+            
+            if (callbackHandler == null){
+                this.callbackHandler = new CallbackHandler(null);
+            }
+        }
+        
+        if (callbackHandler.getCallbackTargetURI() != null){
+            logger.log(Level.FINE, "Selecting callback EPR using address from forward message: " + callbackHandler.getCallbackTargetURI());
+        } else {
+            logger.log(Level.FINE, "Selecting callback EPR using address but callback URI is null");
+        }
+        
+        // Work out which callback EPR to use
+        callbackEPR = selectCallbackEPR(msgContext);
+        if (callbackEPR == null) {
+            throw new ServiceRuntimeException("No callback binding found for " + msgContext.getTo().toString());
+        }
+        
+        // configure the callback EPR with the callback address
+        if (callbackHandler.getCallbackTargetURI() != null) {
+            callbackEPR = setCallbackAddress(callbackEPR);
+        }
+        
+        this.resolvedEndpoint = callbackEPR.getTargetEndpoint();
     }
     
+    public CallbackHandler getCallbackHandler() {
+        return callbackHandler;
+    }
+    
+    /** 
+     * Gets the message ID associated with this callback reference. All calls through the proxy backed by 
+     * this CallbackServiceReference will use the same msgID
+     * 
+     * @return the message ID
+     */
+    public String getMsgID() {
+        return msgID;
+    }
+    
+    
     private static CompositeContext getCompositeContext(List<? extends EndpointReference> callbackEPRs) {
         if(!callbackEPRs.isEmpty()) {
             RuntimeEndpointReference epr = (RuntimeEndpointReference) callbackEPRs.get(0);
@@ -71,29 +190,13 @@ public class CallbackServiceReferenceImp
         return null;
     }
 
-    public void init() {
-        Message msgContext = ThreadMessageContext.getMessageContext();
-        callbackEPR = selectCallbackEPR(msgContext);
-        if (callbackEPR == null) {
-            throw new ServiceRuntimeException("No callback binding found for " + msgContext.getTo().toString());
-        }
-        resolvedEndpoint = msgContext.getFrom().getCallbackEndpoint();
-        
-        // Capture the Message ID from the message which caused the creation of this CallBackServiceReference
-        this.msgID = (String) msgContext.getHeaders().get(Constants.MESSAGE_ID);
-    }
-
     @Override
     protected B createProxy() throws Exception {
         return proxyFactory.createCallbackProxy(this);
     }
 
     public RuntimeEndpointReference getCallbackEPR() {
-        if (resolvedEndpoint == null) {
-            return null;
-        } else {
-            return cloneAndBind(callbackEPR);
-        }
+        return callbackEPR;    
     }
 
     public Endpoint getResolvedEndpoint() {
@@ -101,6 +204,7 @@ public class CallbackServiceReferenceImp
     }
 
     private RuntimeEndpointReference selectCallbackEPR(Message msgContext) {
+        
         // look for callback binding with same name as service binding
         Endpoint to = msgContext.getTo();
         if (to == null) {
@@ -124,56 +228,58 @@ public class CallbackServiceReferenceImp
         return null;
     }
 
-    private RuntimeEndpointReference cloneAndBind(RuntimeEndpointReference endpointReference) {
-        if (resolvedEndpoint != null) {
-
-            try {
-                RuntimeEndpointReference epr = (RuntimeEndpointReference)endpointReference.clone();
-                epr.setTargetEndpoint(resolvedEndpoint);
+    private RuntimeEndpointReference setCallbackAddress(RuntimeEndpointReference endpointReference) {
+        try {
+            
+            RuntimeEndpointReference epr = endpointReference;
+            
+            if (callbackHandler.getCloneCallbackWire()){
+                epr = (RuntimeEndpointReference)endpointReference.clone();
+            } 
+            
+            // TUSCANY-3932
+            // If it's the default binding then we're going to look the callback endpoint
+            // up in the registry. Most remote protocols, which may be used as delegates 
+            // for binding.sca, will expect to deal with absolute URLs so flip the 
+            // callback endpoint back to force the lookup to happen
+            if (epr.getBinding().getType().equals(SCABinding.TYPE)){
+                // A/ create a callback endpoint to allow the
+                //    callback lookup to take place
+                epr.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
+               
+                // if an endpoint it provided in the forward message use it or
+                // if not create one
+                if (resolvedEndpoint == null ){
+                    RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
+                    callbackEndpoint.setURI(callbackHandler.getCallbackTargetURI());
+                    callbackEndpoint.setUnresolved(true);
+                    epr.setTargetEndpoint(callbackEndpoint);
+                } else {
+                    epr.setTargetEndpoint(resolvedEndpoint);
+                }
+            } else {
+                // B/ and C/ assume that the callback EPR is already resolved
+                //           and set the binding URI if one is provided with the
+                //           forward message. Some bindings may want to do other
+                //           things to determine the callback URI to the 
+                //           CallbackHandler will be sent in the callback message
+                //           header. This is particularly true if the clone isn't
+                //           called above because resetting the URI will not 
+                //           be thread safe.
+                epr.setStatus(EndpointReference.Status.RESOLVED_BINDING);
                 
-                // TUSCANY-3932
-                // If it's the default binding then we're going to look the callback endpoint
-                // up in the registry. Most remote protocols, which may be used as delegates 
-                // for binding.sca, will expect to deal with absolute URLs so flip the 
-                // callback endpoint back to force the lookup to happen
-                if (epr.getBinding().getType().equals(SCABinding.TYPE)){
-                    epr.setStatus(EndpointReference.Status.WIRED_TARGET_NOT_FOUND);
+                if ( callbackHandler.getCallbackTargetURI() != null ){
+                    epr.getBinding().setURI(callbackHandler.getCallbackTargetURI());
                 } else {
-                    // just copy the callback binding from the callback endpoint to the
-                    // callback EPR as the EPR is effectively already resolved
-                    epr.setStatus(EndpointReference.Status.RESOLVED_BINDING);
-                    Binding callbackBinding = resolvedEndpoint.getBinding();
-                    if ( callbackBinding != null){
-                        epr.setBinding(callbackBinding);
-                        // make sure that the chains are recreated for
-                        // this new binding
-                        epr.setBindingProvider(null);
-                        epr.rebuild();
-                    } else {
-                        // do nothing and rely on whatever the user has configured 
-                        // in the SCDL
-                    }
+                    // do nothing and rely on whatever the user has configured 
+                    // in the SCDL
                 }
-            
-                return epr;
-            } catch (CloneNotSupportedException e) {
-                // will not happen
-                throw new ServiceRuntimeException(e);
             }
-        } else {
-            return null;
-        }
-    }
-    
-    private void build(EndpointReference endpointReference) {
-        BindingBuilder builder = builders.getBindingBuilder(endpointReference.getBinding().getType());
-        if (builder != null) {
-            builder.build(endpointReference.getComponent(),
-                          endpointReference.getReference(),
-                          endpointReference.getBinding(),
-                          new BuilderContext(registry),
-                          false);
+        
+            return epr;
+        } catch (CloneNotSupportedException e) {
+            // will not happen
+            throw new ServiceRuntimeException(e);
         }
-    }    
-
+    } 
 }

Added: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackHandler.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackHandler.java?rev=1242412&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackHandler.java (added)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/CallbackHandler.java Thu Feb  9 17:46:50 2012
@@ -0,0 +1,53 @@
+/*
+ * 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.tuscany.sca.core.invocation;
+
+/**
+ * Models callback information arriving in the forward message 
+ */
+public class CallbackHandler {
+    private String callbackTargetURI;
+    private boolean cloneCallbackWire = true;
+    
+    public CallbackHandler(String callbackTargetURI){
+        setCallbackTargetURI(callbackTargetURI);
+    }
+    
+    public CallbackHandler(String callbackTargetURI, boolean cloneCallbackWire){
+        setCallbackTargetURI(callbackTargetURI);
+        setCloneCallbackWire(cloneCallbackWire);
+    }
+    
+    public String getCallbackTargetURI() {
+        return callbackTargetURI;
+    }
+    
+    public boolean getCloneCallbackWire() {
+        return cloneCallbackWire;
+    }
+    
+    public void setCallbackTargetURI(String callbackTargetURI) {
+        this.callbackTargetURI = callbackTargetURI;     
+    }
+    
+    public void setCloneCallbackWire(boolean cloneCallbackWire) {
+        this.cloneCallbackWire = cloneCallbackWire;
+    }
+}

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/Constants.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/Constants.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/Constants.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/Constants.java Thu Feb  9 17:46:50 2012
@@ -28,6 +28,7 @@ public interface Constants {
     public static final String RELATES_TO 				= "RELATES_TO";
     public static final String ASYNC_RESPONSE_INVOKER 	= "ASYNC_RESPONSE_INVOKER";
     public static final String ASYNC_CALLBACK 			= "ASYNC_CALLBACK";
+    public static final String CALLBACK                 = "CALLBACK";
     
     /**
      *  If you've set the TCCL in your binding impl according to OASIS rules you can prevent

Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java (original)
+++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/invocation/impl/JDKCallbackInvocationHandler.java Thu Feb  9 17:46:50 2012
@@ -105,6 +105,9 @@ public class JDKCallbackInvocationHandle
                 msg.setTo(((RuntimeEndpointReference)source).getTargetEndpoint());
             }
         }
+        
+        msg.getHeaders().put(Constants.CALLBACK, ((CallbackServiceReferenceImpl)callableReference).getCallbackHandler());
+        
         Invoker headInvoker = chain.getHeadInvoker();
         
         Operation operation = null;

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldCallbackServiceImpl.java Thu Feb  9 17:46:50 2012
@@ -32,7 +32,11 @@ public class HelloWorldCallbackServiceIm
     
     public String getGreetings(String s) {
         System.out.println("Entering SCA HelloWorldCallbackService.getGreetings: " + s);
-        String response = helloWorldCallback.getGreetingsCallback(s);
+        String response = null;
+        for (int i = 0; i < 5 ; i++){
+            System.out.println("In SCA HelloWorldCallbackService.getGreetings: calling helloWorldCallback.getGreetingsCallback(s) interation " + i);
+            response = helloWorldCallback.getGreetingsCallback(s);
+        }
         System.out.println("Leaving SCA HelloWorldCallbackService.getGreetings: " + response);
         return response;
     }
@@ -46,7 +50,11 @@ public class HelloWorldCallbackServiceIm
 
     public Foo getGreetingsComplex(Foo foo){
         System.out.println("Entering SCA HelloWorldCallbackService.getGreetingsComplex: " + foo.getBars().get(0).getS());
-        Foo response = helloWorldCallback.getGreetingsComplexCallback(foo);
+        Foo response = null;
+        for (int i = 0; i < 5 ; i++){
+            System.out.println("In SCA HelloWorldCallbackService.getGreetingsComplex: calling helloWorldCallback.getGreetingsComplexCallback(s) interation " + i);
+            response = helloWorldCallback.getGreetingsComplexCallback(foo);
+        }
         System.out.println("Leaving SCA HelloWorldCallbackService.getGreetingsComplex: " + foo.getBars().get(0).getS());
         return response;
     } 

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/java/org/apache/tuscany/sca/binding/ws/HelloWorldImpl.java Thu Feb  9 17:46:50 2012
@@ -20,10 +20,13 @@
 package org.apache.tuscany.sca.binding.ws;
 
 import javax.jws.WebService;
+import javax.security.auth.Subject;
 
 import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.Foo;
 import org.apache.tuscany.sca.binding.ws.jaxws.external.service.iface.HelloWorldService;
+import org.oasisopen.sca.RequestContext;
 import org.oasisopen.sca.ServiceRuntimeException;
+import org.oasisopen.sca.annotation.Context;
 import org.oasisopen.sca.annotation.Reference;
 
 @WebService
@@ -35,25 +38,36 @@ public class HelloWorldImpl implements H
     @Reference
     public HelloWorldCallbackService helloWorldCallbackService;
     
+    @Context
+    protected RequestContext requestContext;
+    
     // HelloWorld operations
     
     public String getGreetings(String s) {
         System.out.println("Entering SCA HelloWorld.getGreetings: " + s);
-        String response = helloWorldCallbackService.getGreetings(s);
+        String response = null;
+        for (int i = 0; i < 5 ; i++){
+            System.out.println("In SCA HelloWorld.getGreetings: calling helloWorldCallbackService.getGreetings(s) interation " + i);
+            response = helloWorldCallbackService.getGreetings(s);
+        }
         System.out.println("Leaving SCA HelloWorld.getGreetings: " + response);
         return response;
     }
     
     public String getGreetingsException(String s) throws ServiceRuntimeException {
         System.out.println("Entering SCA HelloWorld.getGreetingsException: " + s);
-        String response = helloWorldCallbackService.getGreetings(s);
+        String response = helloWorldCallbackService.getGreetings(s);          
         System.out.println("Leaving SCA HelloWorld.getGreetings: " + response);
         throw new ServiceRuntimeException(response);
     }    
 
     public Foo getGreetingsComplex(Foo foo){
         System.out.println("Entering SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
-        Foo response = helloWorldCallbackService.getGreetingsComplex(foo);
+        Foo response = null;
+        for (int i = 0; i < 5 ; i++){
+            System.out.println("In SCA HelloWorld.getGreetingsComplex: calling helloWorldCallbackService.getGreetingsComplex(foo) interation " + i);
+            response = helloWorldCallbackService.getGreetingsComplex(foo);
+        }
         System.out.println("Leaving SCA HelloWorld.getGreetingsComplex: " + foo.getBars().get(0).getS());
         return response;
     } 
@@ -63,6 +77,12 @@ public class HelloWorldImpl implements H
     public String getGreetingsCallback(String s) {
         System.out.println("Entering SCA HelloWorld.getGreetingsCallback: " + s);
         String response = helloWorldExternal.getGreetings(s);
+        
+        Subject subject = requestContext.getSecuritySubject();
+        if (subject == null){
+            response = "No Security Subject";
+        }
+        
         System.out.println("Leaving SCA HelloWorld.getGreetingsCallback: " + response);
         return response;
     }

Added: tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml?rev=1242412&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml (added)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/META-INF/definitions.xml Thu Feb  9 17:46:50 2012
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+    * 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.    
+-->
+<definitions xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912" 
+             targetNamespace="http://tuscany.apache.org/xmlns/sca/1.1"
+             xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+    		 xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912" >
+
+
+    <sca:policySet name="BasicAuthenticationPolicySet"
+                   provides="clientAuthentication.transport"
+                   appliesTo="//sca:binding.ws">
+        <tuscany:basicAuthentication>
+          <tuscany:userName>myname</tuscany:userName>
+          <tuscany:password>mypassword</tuscany:password>
+        </tuscany:basicAuthentication>
+    </sca:policySet>
+        
+      
+</definitions>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/contribution-callback-fullspec/src/main/resources/helloworld.composite Thu Feb  9 17:46:50 2012
@@ -19,6 +19,7 @@
 -->
 <composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
 		   xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+		   xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
 		   targetNamespace="http://www.tuscany.apache.org/itests/binding/ws/axis2"
            name="HelloWorld">
                
@@ -33,7 +34,7 @@
         <reference name="helloWorldCallbackService">
             <binding.ws uri="http://localhost:8084/HelloWorldCallbackService"/>
             <callback>
-                <binding.ws uri="http://localhost:8085/HelloWorldService/HelloWorldCallback"/>
+                <binding.ws uri="http://localhost:8085/HelloWorldService/HelloWorldCallback" policySets="tuscany:BasicAuthenticationPolicySet"/>
             </callback>
         </reference>
     </component>
@@ -43,7 +44,7 @@
         <service name="HelloWorldCallbackService">
             <binding.ws uri="http://localhost:8084/HelloWorldCallbackService"/>
             <callback>
-                <binding.ws/>
+                <binding.ws  policySets="tuscany:BasicAuthenticationPolicySet"/>
             </callback>            
         </service>   
     </component>    

Modified: tuscany/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java?rev=1242412&r1=1242411&r2=1242412&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java (original)
+++ tuscany/sca-java-2.x/trunk/testing/itest/ws/launcher-axis2/src/test/java/org/apache/tuscany/sca/binding/ws/launcher/axis2/CallbackFullSpecTestCase.java Thu Feb  9 17:46:50 2012
@@ -22,13 +22,22 @@ package org.apache.tuscany.sca.binding.w
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.EndpointReference;
+import org.apache.tuscany.sca.assembly.Reference;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.binding.ws.WebServiceBinding;
 import org.apache.tuscany.sca.binding.ws.jaxws.external.client.HelloWorldClientLauncher;
 import org.apache.tuscany.sca.binding.ws.jaxws.external.service.HelloWorldServiceLauncher;
 import org.apache.tuscany.sca.binding.ws.jaxws.sca.Bar;
 import org.apache.tuscany.sca.binding.ws.jaxws.sca.Foo;
+import org.apache.tuscany.sca.node.impl.NodeImpl;
 import org.apache.tuscany.sca.node.Contribution;
 import org.apache.tuscany.sca.node.Node;
 import org.apache.tuscany.sca.node.NodeFactory;
+import org.apache.tuscany.sca.policy.PolicySubject;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -71,6 +80,7 @@ public class CallbackFullSpecTestCase {
     @Test
     public void testGetGreetings() throws Exception {
         assertEquals("Hello Fred", externalClient.getGreetings("Fred"));
+        assertEquals("Hello Fred", externalClient.getGreetings("Fred"));
     }
         
     @Test
@@ -101,6 +111,18 @@ public class CallbackFullSpecTestCase {
         assertTrue(f2.getBars().get(2).isB().booleanValue());
     }  
     
+    @Test
+    public void testCallbackBindingConfig() throws Exception {
+        Component helloWorldCallbackServiceComponent = ((NodeImpl)node).getDomainComposite().getComponent("HelloWorldCallbackService");
+        Service helloWorldService = helloWorldCallbackServiceComponent.getService("HelloWorldCallbackService");
+        Reference callbackReference = ((RuntimeComponentService)helloWorldService).getCallbackReference();
+        for (EndpointReference epr : callbackReference.getEndpointReferences()){
+            Binding callbackBinding = epr.getBinding();
+            assertEquals(WebServiceBinding.TYPE, callbackBinding.getType());
+            assertEquals(1, ((PolicySubject)callbackBinding).getPolicySets().size());
+        }
+    }
+    
     @After
     public void tearDown() throws Exception {
         node.stop();



Mime
View raw message