You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by Raymond Feng <en...@gmail.com> on 2012/03/23 00:23:20 UTC

Re: svn commit: r1304128 - in /tuscany/sca-java-2.x/trunk/modules: assembly/src/main/java/org/apache/tuscany/sca/assembly/ assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/p...

This should conclude the argument that Ant was having with us. His change is now added back with all the fixes to the binding invokers made by the "to-be-nicer" guy.

Thanks,
Raymond

On Mar 22, 2012, at 4:19 PM, rfeng@apache.org wrote:

> Author: rfeng
> Date: Thu Mar 22 23:19:17 2012
> New Revision: 1304128
> 
> URL: http://svn.apache.org/viewvc?rev=1304128&view=rev
> Log:
> Fix the binding invokers to use endpoint reference's deployed URI (i.e., the target service endpoint address)
> 
> Added:
>    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java   (with props)
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java   (with props)
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java   (with props)
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java   (with props)
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java   (with props)
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/resources/rest-reference.composite
>      - copied, changed from r1303591, tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite
> Modified:
>    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java
>    tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
>    tuscany/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
>    tuscany/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java
>    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JsonRpcInvoker.java
>    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite
>    tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCReference.composite
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java
>    tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTReferenceBindingProvider.java
>    tuscany/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java
>    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java
>    tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EndpointReference.java Thu Mar 22 23:19:17 2012
> @@ -123,6 +123,17 @@ public interface EndpointReference exten
>      * @param endpoint the target endpoint
>      */
>     void setTargetEndpoint(Endpoint targetEndpoint);
> +    
> +    /**
> +     * Get the deployed URI of the corresponding service endpoint
> +     * @return The deployed URI
> +     */
> +    String getDeployedURI();
> +    /**
> +     * Set the deployed URI
> +     * @param deployedURI
> +     */
> +    void setDeployedURI(String deployedURI);
> 
>     /**
>      * Returns the interface contract defining the interface
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/EndpointReferenceImpl.java Thu Mar 22 23:19:17 2012
> @@ -48,6 +48,7 @@ public class EndpointReferenceImpl imple
>     protected transient ContractBuilder contractBuilder;    
>     protected boolean unresolved = true;
>     protected String uri;
> +    protected String deployedURI;
>     protected Component component;
>     protected ComponentReference reference;
>     protected Binding binding;
> @@ -231,6 +232,29 @@ public class EndpointReferenceImpl imple
>         this.status = status;
>     }
> 
> +    @Override
> +    public String getDeployedURI() {
> +        String targetURI = deployedURI;
> +        if (targetURI != null) {
> +            return targetURI;
> +        }
> +        if (getTargetEndpoint() != null) {
> +            targetURI = getTargetEndpoint().getDeployedURI();
> +        }
> +        if (targetURI != null) {
> +            return targetURI;
> +        }
> +        if (binding != null) {
> +            targetURI = binding.getURI();
> +        }
> +        return targetURI;
> +    }
> +    
> +    @Override
> +    public void setDeployedURI(String deployedURI) {
> +        this.deployedURI = deployedURI;
> +    }
> +    
>     /**
>      * Indicates whether this EndpointReference is connected to a target service which is asynchronous.
>      * This can be marked in one of 3 ways:
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-atom-runtime/src/main/java/org/apache/tuscany/sca/binding/atom/provider/AtomReferenceBindingProvider.java Thu Mar 22 23:19:17 2012
> @@ -77,6 +77,7 @@ class AtomReferenceBindingProvider imple
>     public Invoker createInvoker(Operation operation) {
> 
>         String operationName = operation.getName();            
> +        String uri = endpointReference.getDeployedURI();
>         if (operationName.equals("get")) { 
> 
>             // Determine the collection item type
> @@ -87,25 +88,25 @@ class AtomReferenceBindingProvider imple
>                 supportsFeedEntries = true;
>             }
> 
> -            return new AtomBindingInvoker.GetInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.GetInvoker(operation, uri, httpClient, authorizationHeader, this);
> 
>         } else if (operationName.equals("post")) {
> -            return new AtomBindingInvoker.PostInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.PostInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("put")) {
> -            return new AtomBindingInvoker.PutInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.PutInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("delete")) {
> -            return new AtomBindingInvoker.DeleteInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.DeleteInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("getFeed") || operationName.equals("getAll")) {
> -            return new AtomBindingInvoker.GetAllInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.GetAllInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("postMedia")) {
> -            return new AtomBindingInvoker.PostMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.PostMediaInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("putMedia")) {
> -            return new AtomBindingInvoker.PutMediaInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.PutMediaInvoker(operation, uri, httpClient, authorizationHeader, this);
>         } else if (operationName.equals("query")) {
> -            return new AtomBindingInvoker.QueryInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +            return new AtomBindingInvoker.QueryInvoker(operation, uri, httpClient, authorizationHeader, this);
>         }
> 
> -        return new AtomBindingInvoker(operation, binding.getURI(), httpClient, authorizationHeader, this);
> +        return new AtomBindingInvoker(operation, uri, httpClient, authorizationHeader, this);
>     }
> 
>     public InterfaceContract getBindingInterfaceContract() {
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-jsonp-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonp/runtime/JSONPInvoker.java Thu Mar 22 23:19:17 2012
> @@ -65,7 +65,7 @@ public class JSONPInvoker implements Inv
>     }
> 
>     public Message doInvoke(Message msg) throws JsonGenerationException, JsonMappingException, IOException, EncoderException {
> -        String uri = endpoint.getBinding().getURI() + "/" + operation.getName();
> +        String uri = endpoint.getDeployedURI() + "/" + operation.getName();
>         //String[] jsonArgs = objectsToJSON((Object[])msg.getBody());
>         String[] jsonArgs = objectsToJSONStrings((Object[])msg.getBody());
> 
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JsonRpcInvoker.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JsonRpcInvoker.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JsonRpcInvoker.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/provider/JsonRpcInvoker.java Thu Mar 22 23:19:17 2012
> @@ -70,7 +70,7 @@ public class JsonRpcInvoker implements I
>     public JsonRpcInvoker(EndpointReference endpointReference, Operation operation, HttpClient httpClient) {
>         this.endpointReference = endpointReference;
>         this.operation = operation;
> -        this.uri = endpointReference.getBinding().getURI();
> +        this.uri = endpointReference.getDeployedURI();
>         this.httpClient = httpClient;
>     }
> 
> 
> Added: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java?rev=1304128&view=auto
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java (added)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java Thu Mar 22 23:19:17 2012
> @@ -0,0 +1,117 @@
> +/*
> + * 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.binding.jsonrpc;
> +
> +import java.util.Arrays;
> +
> +import junit.framework.Assert;
> +
> +import org.apache.tuscany.sca.node.Contribution;
> +import org.apache.tuscany.sca.node.ContributionLocationHelper;
> +import org.apache.tuscany.sca.node.Node;
> +import org.apache.tuscany.sca.node.NodeFactory;
> +import org.junit.AfterClass;
> +import org.junit.BeforeClass;
> +import org.junit.Test;
> +
> +import bean.TestBean;
> +import echo.Echo;
> +
> +public class JSONRPCReferenceTargetTestCase {
> +    private static final String ECHO_COMPONENT_WITH_REFERENCE = "EchoComponentWithReferenceTarget";
> +    private static Node node;
> +
> +    @BeforeClass
> +    public static void setUp() throws Exception {
> +        try {
> +            String contribution = ContributionLocationHelper.getContributionLocation(JSONRPCReferenceTargetTestCase.class);
> +            node =
> +                NodeFactory.newInstance().createNode(new Contribution("testClient", contribution));
> +            node.start();
> +
> +        } catch (Exception e) {
> +            e.printStackTrace();
> +        }
> +    }
> +
> +    @AfterClass
> +    public static void tearDown() throws Exception {
> +        node.stop();
> +    }
> +
> +    @Test
> +    public void testInvokeReference() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, ECHO_COMPONENT_WITH_REFERENCE);
> +        String result = echoComponent.echo("ABC");
> +        Assert.assertEquals("echo: ABC", result);
> +    }
> +
> +    @Test
> +    public void testInvokeBeanReference() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, ECHO_COMPONENT_WITH_REFERENCE);
> +        TestBean bean = new TestBean();
> +        bean.setTestInt(1);
> +        bean.setTestString("123");
> +        bean.setStringArray(Arrays.asList("A", "B"));
> +        TestBean result = echoComponent.echoBean(bean);
> +        Assert.assertEquals(bean, result);
> +    }
> +
> +    @Test
> +    public void testInvokeReferenceVoidOperation() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, ECHO_COMPONENT_WITH_REFERENCE);
> +        echoComponent.echoVoid();
> +    }
> +
> +    @Test(expected = Exception.class)
> +    public void testInvokeReferenceException() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, ECHO_COMPONENT_WITH_REFERENCE);
> +        try {
> +            echoComponent.echoBusinessException();
> +        } catch (Exception e) {
> +            System.err.println(e);
> +            throw e;
> +        }
> +    }
> +
> +    @Test
> +    public void testInvokeReference20() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, "EchoComponentWithReference20");
> +        String result = echoComponent.echo("ABC");
> +        Assert.assertEquals("echo: ABC", result);
> +    }
> +
> +    @Test
> +    public void testInvokeReferenceVoidOperation20() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, "EchoComponentWithReference20");
> +        echoComponent.echoVoid();
> +    }
> +
> +    @Test(expected = Exception.class)
> +    public void testInvokeReferenceException20() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, "EchoComponentWithReference20");
> +        try {
> +            echoComponent.echoBusinessException();
> +        } catch (Exception e) {
> +            System.err.println(e);
> +            throw e;
> +        }
> +    }
> +
> +}
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/java/org/apache/tuscany/sca/binding/jsonrpc/JSONRPCReferenceTargetTestCase.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite Thu Mar 22 23:19:17 2012
> @@ -36,4 +36,12 @@
>         </service>
>     </component>
> 
> +    <component name="EchoComponent1">
> +        <implementation.java class="echo.EchoComponentImpl"/>
> +        <service name="Echo">
> +            <tuscany:binding.jsonrpc name="jsonrpc" uri="/services/EchoService"/>
> +            <tuscany:binding.jsonrpc version="2.0" name="jsonrpc20" uri="/services/EchoService20"/>
> +        </service>
> +    </component>
> +    
> </composite>
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCReference.composite
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCReference.composite?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCReference.composite (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCReference.composite Thu Mar 22 23:19:17 2012
> @@ -38,4 +38,11 @@
>         </reference>
>     </component>
> 
> +    <component name="EchoComponentWithReferenceTarget">
> +        <implementation.java class="echo.EchoClientImpl" />
> +        <reference name="echoReference" target="EchoComponent1/Echo/jsonrpc">
> +        </reference>
> +    </component>
> +    
> +    
> </composite>
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/META-INF/MANIFEST.MF Thu Mar 22 23:19:17 2012
> @@ -30,6 +30,7 @@ Import-Package: javax.jws,
>  org.apache.tuscany.sca.databinding.xml;version="2.0.0",
>  org.apache.tuscany.sca.extensibility;version="2.0.0",
>  org.apache.tuscany.sca.host.http;version="2.0.0",
> + org.apache.tuscany.sca.host.http.client;version="2.0.0",
>  org.apache.tuscany.sca.interfacedef;version="2.0.0",
>  org.apache.tuscany.sca.interfacedef.impl;version="2.0.0",
>  org.apache.tuscany.sca.interfacedef.java;version="2.0.0",
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTBindingInvoker.java Thu Mar 22 23:19:17 2012
> @@ -55,6 +55,7 @@ import javax.ws.rs.core.MediaType;
> import javax.ws.rs.core.UriBuilder;
> 
> import org.apache.http.client.HttpClient;
> +import org.apache.tuscany.sca.assembly.EndpointReference;
> import org.apache.tuscany.sca.assembly.WireFormat;
> import org.apache.tuscany.sca.binding.rest.RESTBinding;
> import org.apache.tuscany.sca.binding.rest.wireformat.json.JSONWireFormat;
> @@ -77,15 +78,17 @@ import org.apache.wink.client.handlers.B
>  */
> public class RESTBindingInvoker implements Invoker {
>     private ExtensionPointRegistry registry;
> +    private EndpointReference endpointReference;
>     private RESTBinding binding;
>     private Operation operation;
>     private RestClient restClient;
>     private String httpMethod;
>     private Class<?> responseType;
> 
> -    public RESTBindingInvoker(ExtensionPointRegistry registry, RESTBinding binding, Operation operation, HttpClient httpClient) {
> +    public RESTBindingInvoker(ExtensionPointRegistry registry, EndpointReference endpointReference, RESTBinding binding, Operation operation, HttpClient httpClient) {
>         super();
>         this.registry = registry;
> +        this.endpointReference = endpointReference;
>         this.binding = binding;
>         this.operation = operation;
>         this.restClient = createRestClient(httpClient);
> @@ -165,7 +168,7 @@ public class RESTBindingInvoker implemen
>         Object entity = null;
>         Object[] args = msg.getBody();
> 
> -        URI uri = URI.create(binding.getURI());
> +        URI uri = URI.create(endpointReference.getDeployedURI());
>         UriBuilder uriBuilder = UriBuilder.fromUri(uri);
> 
>         Method method = ((JavaOperation)operation).getJavaMethod();
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTReferenceBindingProvider.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTReferenceBindingProvider.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTReferenceBindingProvider.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/main/java/org/apache/tuscany/sca/binding/rest/provider/RESTReferenceBindingProvider.java Thu Mar 22 23:19:17 2012
> @@ -50,7 +50,7 @@ public class RESTReferenceBindingProvide
>     }
> 
>     public Invoker createInvoker(Operation operation) {
> -        return new RESTBindingInvoker(registry, (RESTBinding)endpointReference.getBinding(), operation, httpClient);
> +        return new RESTBindingInvoker(registry, endpointReference, (RESTBinding)endpointReference.getBinding(), operation, httpClient);
>     }
> 
>     public InterfaceContract getBindingInterfaceContract() {
> 
> Added: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java?rev=1304128&view=auto
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java (added)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java Thu Mar 22 23:19:17 2012
> @@ -0,0 +1,65 @@
> +/*
> + * 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.binding.rest;
> +
> +import java.util.Arrays;
> +
> +import junit.framework.Assert;
> +
> +import org.apache.tuscany.sca.node.Contribution;
> +import org.apache.tuscany.sca.node.ContributionLocationHelper;
> +import org.apache.tuscany.sca.node.Node;
> +import org.apache.tuscany.sca.node.NodeFactory;
> +import org.junit.AfterClass;
> +import org.junit.BeforeClass;
> +import org.junit.Test;
> +
> +import services.echo.jaxrs.Echo;
> +
> +public class RESTReferenceTestCase {
> +    private static final String ECHO_COMPONENT_WITH_REFERENCE = "EchoClientComponent/Echo";
> +    private static Node node;
> +
> +    @BeforeClass
> +    public static void setUp() throws Exception {
> +        try {
> +            String contribution = ContributionLocationHelper.getContributionLocation(RESTReferenceTestCase.class);
> +            node =
> +                NodeFactory.newInstance().createNode("rest-reference.composite",
> +                                                     new Contribution("testClient", contribution));
> +            node.start();
> +
> +        } catch (Exception e) {
> +            e.printStackTrace();
> +        }
> +    }
> +
> +    @AfterClass
> +    public static void tearDown() throws Exception {
> +        node.stop();
> +    }
> +
> +    @Test
> +    public void testInvokeReference() throws Exception {
> +        Echo echoComponent = node.getService(Echo.class, ECHO_COMPONENT_WITH_REFERENCE);
> +        String result = echoComponent.echo("ABC");
> +        Assert.assertEquals("echo: ABC", result);
> +    }
> +
> +}
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/org/apache/tuscany/sca/binding/rest/RESTReferenceTestCase.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
> 
> Added: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java?rev=1304128&view=auto
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java (added)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java Thu Mar 22 23:19:17 2012
> @@ -0,0 +1,47 @@
> +/*
> + * 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 services.echo.jaxrs;
> +
> +import javax.ws.rs.GET;
> +import javax.ws.rs.Path;
> +import javax.ws.rs.QueryParam;
> +
> +import org.oasisopen.sca.annotation.Remotable;
> +
> +/**
> + * Interface of our sample JSONRPC service.
> + *
> + * @version $Rev$ $Date$
> + */
> +@Remotable
> +@Path("")
> +public interface Echo {
> +    @GET
> +    String echo(@QueryParam("msg") String msg);
> +
> +    @GET
> +    int echoInt(@QueryParam("param") int param);
> +
> +    @GET
> +    String [] echoArrayString(@QueryParam("msgArray") String[] stringArray);
> +
> +    @GET
> +    int [] echoArrayInt(@QueryParam("intArray") int[] intArray);
> +
> +}
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/Echo.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
> 
> Added: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java?rev=1304128&view=auto
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java (added)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java Thu Mar 22 23:19:17 2012
> @@ -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 services.echo.jaxrs;
> +
> +import org.oasisopen.sca.annotation.Reference;
> +
> +public class EchoClientImpl implements Echo {
> +    @Reference
> +    private Echo echoService;
> +
> +    public String echo(String msg) {
> +        return "echo: "+ echoService.echo(msg);
> +    }
> +
> +    public int echoInt(int param) {
> +        return echoService.echoInt(param);
> +    }
> +
> +    public String[] echoArrayString(String[] stringArray) {
> +        return echoService.echoArrayString(stringArray);
> +    }
> +
> +    public int[] echoArrayInt(int[] intArray) {
> +        return echoService.echoArrayInt(intArray);
> +    }
> +}
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoClientImpl.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
> 
> Added: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java?rev=1304128&view=auto
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java (added)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java Thu Mar 22 23:19:17 2012
> @@ -0,0 +1,45 @@
> +/*
> + * 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 services.echo.jaxrs;
> +
> +
> +/**
> + * A simple client component that uses a reference with an REST binding.
> + *
> + * @version $Rev$ $Date$
> + */
> +public class EchoImpl implements Echo {
> +
> +    public String echo(String msg) {
> +        return msg;
> +    }
> +
> +    public int echoInt(int param) {
> +        int value = param;
> +        return value;
> +    }
> +
> +    public String[] echoArrayString(String[] stringArray) {
> +        return stringArray;
> +    }
> +
> +    public int[] echoArrayInt(int[] intArray) {
> +        return intArray;
> +    }
> +}
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java
> ------------------------------------------------------------------------------
>    svn:eol-style = native
> 
> Propchange: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/java/services/echo/jaxrs/EchoImpl.java
> ------------------------------------------------------------------------------
>    svn:keywords = Rev Date
> 
> Copied: tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/resources/rest-reference.composite (from r1303591, tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite)
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/resources/rest-reference.composite?p2=tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/resources/rest-reference.composite&p1=tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite&r1=1303591&r2=1304128&rev=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-jsonrpc-runtime/src/test/resources/JSONRPCBinding.composite (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rest-runtime/src/test/resources/rest-reference.composite Thu Mar 22 23:19:17 2012
> @@ -1,39 +1,42 @@
> -<?xml version="1.0" encoding="UTF-8"?>
> -<!--
> - * 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.    
> --->
> -<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
> -	xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
> -	targetNamespace="http://jsonrpc"
> -	xmlns:jsonrpc="http://jsonrpc"
> -	name="JSONRPCBinding">
> -
> -    <!--service name="EchoService" promote="EchoComponent">
> -        <interface.java interface="echo.Echo"/>
> -        <tuscany:binding.jsonrpc uri="http://localhost:8085/SCADomain/EchoService"/>
> -    </service -->
> -
> -    <component name="EchoComponent">
> -        <implementation.java class="echo.EchoComponentImpl"/>
> -        <service name="Echo">
> -            <tuscany:binding.jsonrpc uri="http://localhost:8085/SCADomain/EchoService"/>
> -            <tuscany:binding.jsonrpc version="2.0" name="jsonrpc20" uri="http://localhost:8085/SCADomain/EchoService20"/>
> -        </service>
> -    </component>
> -    
> -</composite>
> +<?xml version="1.0" encoding="UTF-8"?>
> +<!--
> + * 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.    
> +-->
> +<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912"
> +	xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
> +	targetNamespace="http://rest"
> +	xmlns:rest="http://rest"
> +	name="RESTReference">
> +
> +    <component name="EchoClientComponent">
> +        <implementation.java class="services.echo.jaxrs.EchoClientImpl" />
> +        <reference name="echoService" target="EchoComponent/Echo">
> +        </reference>
> +    </component>
> +
> +    <component name="EchoComponent">
> +        <implementation.java class="services.echo.jaxrs.EchoImpl" />
> +        <service name="Echo">
> +            <tuscany:binding.rest name="rest" uri="/EchoService/rest">
> +            </tuscany:binding.rest>
> +        </service>
> +
> +    </component>
> +    
> +    
> +</composite>
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-rmi-runtime/src/main/java/org/apache/tuscany/sca/binding/rmi/provider/RMIReferenceBindingProvider.java Thu Mar 22 23:19:17 2012
> @@ -40,11 +40,13 @@ import org.apache.tuscany.sca.runtime.Ru
> public class RMIReferenceBindingProvider implements ReferenceBindingProvider {
> 
>     private RuntimeComponentReference reference;
> +    private EndpointReference endpointReference;
>     private RMIBinding binding;
>     private RMIHost rmiHost;
> 
>     public RMIReferenceBindingProvider(EndpointReference endpointReference,
>                                        RMIHost rmiHost) {
> +           this.endpointReference = endpointReference;
>            this.reference = (RuntimeComponentReference)endpointReference.getReference();
>            this.binding = (RMIBinding)endpointReference.getBinding();
>            this.rmiHost = rmiHost;
> @@ -63,7 +65,7 @@ public class RMIReferenceBindingProvider
>             throw new IllegalArgumentException(e);
>         }
> 
> -        return new RMIBindingInvoker(rmiHost, binding.getURI(), remoteMethod);
> +        return new RMIBindingInvoker(rmiHost, endpointReference.getDeployedURI(), remoteMethod);
>     }
> 
>     public void start() {
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/src/main/java/org/apache/tuscany/sca/binding/ws/jaxws/JAXWSBindingInvoker.java Thu Mar 22 23:19:17 2012
> @@ -128,7 +128,7 @@ public class JAXWSBindingInvoker impleme
>         QName serviceName = wsBinding.getService().getQName();
>         QName portName = new QName(serviceName.getNamespaceURI(), wsBinding.getPort().getName());
>         Service service = Service.create(serviceName);
> -        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, wsBinding.getURI());   
> +        service.addPort(portName, SOAPBinding.SOAP11HTTP_BINDING, endpointReference.getDeployedURI());   
> 
>         return service.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE);
>     }
> @@ -154,7 +154,7 @@ public class JAXWSBindingInvoker impleme
>         if (wsdlLocation != null) {
>             return createDispatchFromWSDL(wsdlLocation);
>         } else {
> -            return createDispatchFromURI(wsBinding.getURI());                       
> +            return createDispatchFromURI(endpointReference.getDeployedURI());                       
>         }        
>     }
> 
> @@ -321,7 +321,7 @@ public class JAXWSBindingInvoker impleme
>         if (dynamicDispatchForCallback) {            
>             Endpoint ep = msg.getTo();
>             if (ep != null && ep.getBinding() != null) {
> -                String address = ep.getBinding().getURI();
> +                String address = ep.getDeployedURI();
>                 invocationDispatch = createDynamicDispatch(address);
>             } else {
>                 throw new ServiceRuntimeException("[BWS20025] Unable to determine destination endpoint for endpoint reference " + endpointReference);
> @@ -365,7 +365,7 @@ public class JAXWSBindingInvoker impleme
>             // addWSAFromHeader(sh, fromEPR);
>             SOAPHeaderElement fromH = sh.addHeaderElement(QNAME_WSA_FROM);
>             SOAPElement fromAddress = fromH.addChildElement(QNAME_WSA_ADDRESS);            
> -            fromAddress.setTextContent(callbackEndpoint.getBinding().getURI());
> +            fromAddress.setTextContent(callbackEndpoint.getDeployedURI());
> 
>             addWSAActionHeader(sh, action);
> 
> @@ -406,7 +406,7 @@ public class JAXWSBindingInvoker impleme
>         if (to == null) {
>             Endpoint ep = msg.getTo();
>             if (ep != null && ep.getBinding() != null) {
> -                address = ep.getBinding().getURI();
> +                address = ep.getDeployedURI();
>             } else {
>                 throw new ServiceRuntimeException(
>                                                   "[BWS20025] Unable to determine destination endpoint for endpoint reference " + endpointReference);
> @@ -435,7 +435,7 @@ public class JAXWSBindingInvoker impleme
>             }
>         }
>         if (ep == null || ep.equals("")) {
> -            ep = wsBinding.getURI();
> +            ep = endpointReference.getDeployedURI();
>         }
>         return ep;
>     }
> 
> Modified: tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java
> URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java?rev=1304128&r1=1304127&r2=1304128&view=diff
> ==============================================================================
> --- tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java (original)
> +++ tuscany/sca-java-2.x/trunk/modules/core/src/main/java/org/apache/tuscany/sca/core/runtime/impl/EndpointReferenceBinderImpl.java Thu Mar 22 23:19:17 2012
> @@ -505,15 +505,12 @@ public class EndpointReferenceBinderImpl
>         } else {
>             endpointReference.setTargetEndpoint(matchedEndpoint);
>             Binding binding = matchedEndpoint.getBinding();
> -            // Reverted the change, see https://issues.apache.org/jira/browse/TUSCANY-4029
> -            /*
>             try {
> -				endpointReference.setBinding((Binding) binding.clone());
> -			} catch (CloneNotSupportedException e) {
> -				// shouldn't happen
> -				throw new RuntimeException(e);
> -			}
> -	   */
> +                endpointReference.setBinding((Binding)binding.clone());
> +            } catch (CloneNotSupportedException e) {
> +                // shouldn't happen
> +                throw new RuntimeException(e);
> +            }
>             endpointReference.setBinding(binding);
>             // TUSCANY-3873 - add policy from the service
>             //                we don't care about intents at this stage
> 
>