diff options
Diffstat (limited to 'java/sca/modules/binding-jsonrpc-js-dojo')
-rw-r--r-- | java/sca/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/java/sca/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java b/java/sca/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java index ee47d2243c..fc4d7a2318 100644 --- a/java/sca/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java +++ b/java/sca/modules/binding-jsonrpc-js-dojo/src/main/java/org/apache/tuscany/sca/binding/jsonrpc/js/dojo/JSONRPCBindingJavascriptProxyFactoryImpl.java @@ -27,7 +27,10 @@ import javax.xml.namespace.QName; import org.apache.tuscany.sca.assembly.Binding; import org.apache.tuscany.sca.assembly.ComponentReference; +import org.apache.tuscany.sca.assembly.Endpoint; +import org.apache.tuscany.sca.assembly.EndpointReference; import org.apache.tuscany.sca.binding.jsonrpc.JSONRPCBinding; +import org.apache.tuscany.sca.runtime.RuntimeEndpointReference; import org.apache.tuscany.sca.web.javascript.JavascriptProxyFactory; public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxyFactory { @@ -50,7 +53,17 @@ public class JSONRPCBindingJavascriptProxyFactoryImpl implements JavascriptProxy } public String createJavascriptReference(ComponentReference componentReference) throws IOException { - Binding binding = componentReference.getBindings().get(0); + EndpointReference epr = componentReference.getEndpointReferences().get(0); + Endpoint targetEndpoint = epr.getTargetEndpoint(); + if (targetEndpoint.isUnresolved()) { + //force resolution and targetEndpoint binding calculations + //by calling the getInvocationChain + ((RuntimeEndpointReference) epr).getInvocationChains(); + targetEndpoint = epr.getTargetEndpoint(); + } + + Binding binding = targetEndpoint.getBinding(); + URI targetURI = URI.create(binding.getURI()); String targetPath = targetURI.getPath(); |