You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by fm...@apache.org on 2011/07/08 03:34:34 UTC

svn commit: r1144121 - in /tuscany/sca-java-2.x/contrib/modules/binding-websocket: ./ monsoon-repo/org/apache/websocket/ monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/ src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/ src/test/resources/

Author: fmoga
Date: Fri Jul  8 01:34:33 2011
New Revision: 1144121

URL: http://svn.apache.org/viewvc?rev=1144121&view=rev
Log:
Initial implementation of binding.websocket with functional sample (test).

Added:
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh   (with props)
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java
Removed:
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketStash.java
Modified:
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/maven-metadata-local.xml
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/websocket-0.0.1-SNAPSHOT.jar
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/maven-metadata-local.xml
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/pom.xml
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceBindingProvider.java
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceInvoker.java
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java
    tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/helloworld.composite

Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh?rev=1144121&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh Fri Jul  8 01:34:33 2011
@@ -0,0 +1,2 @@
+#!/bin/bash
+~/apps/apache-maven-2.2.1/bin/mvn org.apache.maven.plugins:maven-install-plugin:2.3.1:install-file -Dfile=target/websocket-0.0.1-SNAPSHOT.jar -DgroupId=org.apache -DartifactId=websocket -Dversion=0.0.1-SNAPSHOT -Dpackaging=jar -DlocalRepositoryPath=/home/fmoga/coding/apache-tuscany/contrib/modules/binding-websocket/monsoon-repo

Propchange: tuscany/sca-java-2.x/contrib/modules/binding-websocket/deploy-monsoon.sh
------------------------------------------------------------------------------
    svn:executable = *

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/maven-metadata-local.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/maven-metadata-local.xml?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/maven-metadata-local.xml (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/maven-metadata-local.xml Fri Jul  8 01:34:33 2011
@@ -7,6 +7,6 @@
     <snapshot>
       <localCopy>true</localCopy>
     </snapshot>
-    <lastUpdated>20110706132527</lastUpdated>
+    <lastUpdated>20110708012442</lastUpdated>
   </versioning>
 </metadata>

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/websocket-0.0.1-SNAPSHOT.jar
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/0.0.1-SNAPSHOT/websocket-0.0.1-SNAPSHOT.jar?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
Binary files - no diff available.

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/maven-metadata-local.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/maven-metadata-local.xml?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/maven-metadata-local.xml (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/monsoon-repo/org/apache/websocket/maven-metadata-local.xml Fri Jul  8 01:34:33 2011
@@ -7,6 +7,6 @@
     <versions>
       <version>0.0.1-SNAPSHOT</version>
     </versions>
-    <lastUpdated>20110706132527</lastUpdated>
+    <lastUpdated>20110708012442</lastUpdated>
   </versioning>
 </metadata>

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/pom.xml?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/pom.xml (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/pom.xml Fri Jul  8 01:34:33 2011
@@ -48,6 +48,13 @@
             <scope>compile</scope>
         </dependency>
         
+	    <dependency>
+	      <groupId>com.google.code.gson</groupId>
+	      <artifactId>gson</artifactId>
+	      <version>1.7.1</version>
+	      <scope>compile</scope>
+	    </dependency>
+        
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>

Added: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java?rev=1144121&view=auto
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java (added)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/JSONUtil.java Fri Jul  8 01:34:33 2011
@@ -0,0 +1,123 @@
+package org.apache.tuscany.sca.binding.websocket.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.interfacedef.DataType;
+import org.apache.tuscany.sca.interfacedef.Operation;
+
+import com.google.gson.Gson;
+
+/**
+ * Helper class to facilitate JSON convertions.
+ */
+public class JSONUtil {
+
+    private static Gson gson = new Gson();
+
+    /**
+     * Convert request parameters from JSON to operation parameter types.
+     * 
+     * @param jsonData
+     *            parameters in JSON array format
+     * @param operation
+     *            the operation to invoke
+     * @return an array of objects
+     */
+    public static Object[] decodeJsonParamsForOperation(String jsonData, Operation operation) {
+        Object[] args = new Object[operation.getInputType().getLogical().size()];
+        final String[] json = parseArray(jsonData);
+        int index = 0;
+        for (final DataType<?> dataType : operation.getInputType().getLogical()) {
+            args[index] = gson.fromJson(json[index], dataType.getPhysical());
+            index++;
+        }
+        return args;
+    }
+
+    /**
+     * Split the JSON array containing the arguments for the method call in
+     * order to avoid converting JSON to Object[]. Converting each object
+     * separately to it's corresponding type avoids type mismatch problems at
+     * service invocation.
+     * 
+     * @param jsonArray
+     *            the JSON array
+     * @return an array of JSON formatted strings
+     */
+    private static String[] parseArray(String jsonArray) {
+        List<String> objects = new ArrayList<String>();
+        int bracketNum = 0;
+        int parNum = 0;
+        int startPos = 1;
+        for (int i = 0; i < jsonArray.length(); i++) {
+            switch (jsonArray.charAt(i)) {
+            case '{':
+                bracketNum++;
+                break;
+            case '}':
+                bracketNum--;
+                break;
+            case '[':
+                parNum++;
+                break;
+            case ']':
+                parNum--;
+                break;
+            case ',':
+                if ((bracketNum == 0) && (parNum == 1)) {
+                    objects.add(jsonArray.substring(startPos, i));
+                    startPos = i + 1;
+                }
+            }
+        }
+        objects.add(jsonArray.substring(startPos, jsonArray.length() - 1));
+        return objects.toArray(new String[] {});
+    }
+
+    private JSONUtil() {
+    }
+
+    /**
+     * Converts a Java object to JSON format.
+     * 
+     * @param response
+     *            the response to convert
+     * @return the object in JSON format
+     */
+    public static String encodeResponse(Object response) {
+        return gson.toJson(response);
+    }
+
+    /**
+     * Convert request parameters as JSON array.
+     * 
+     * @param params
+     *            request parameters
+     * @return request parameters as JSON array
+     */
+    public static String encodeRequestParams(Object[] params) {
+        StringBuilder builder = new StringBuilder();
+        for (int index = 0; index < params.length; index++) {
+            Object param = params[index];
+            builder.append(index == 0 ? "[" : ",");
+            builder.append(gson.toJson(param));
+        }
+        builder.append("]");
+        return builder.toString();
+    }
+
+    /**
+     * Decode JSON to a given Java type.
+     * 
+     * @param responseJSON
+     *            the json to convert
+     * @param returnType
+     *            the return type to convert to
+     * @return the converted object
+     */
+    public static Object decodeResponse(String responseJSON, Class<?> returnType) {
+        return gson.fromJson(responseJSON, returnType);
+    }
+
+}

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceBindingProvider.java?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceBindingProvider.java Fri Jul  8 01:34:33 2011
@@ -28,12 +28,11 @@ import org.apache.tuscany.sca.provider.R
 public class WebsocketReferenceBindingProvider implements ReferenceBindingProvider {
 
     private EndpointReference endpoint;
-    private InterfaceContract contract;
 
     public WebsocketReferenceBindingProvider(EndpointReference endpoint) {
         this.endpoint = endpoint;
     }
-    
+
     public Invoker createInvoker(Operation operation) {
         return new WebsocketReferenceInvoker(operation, endpoint);
     }
@@ -45,7 +44,7 @@ public class WebsocketReferenceBindingPr
     }
 
     public InterfaceContract getBindingInterfaceContract() {
-        return contract;
+        return endpoint.getComponentReferenceInterfaceContract();
     }
 
     public boolean supportsOneWayInvocation() {

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceInvoker.java?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceInvoker.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketReferenceInvoker.java Fri Jul  8 01:34:33 2011
@@ -19,13 +19,20 @@
 
 package org.apache.tuscany.sca.binding.websocket.runtime;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.SocketChannel;
+
 import org.apache.tuscany.sca.assembly.EndpointReference;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.invocation.Invoker;
 import org.apache.tuscany.sca.invocation.Message;
+import org.apache.websocket.WebSocket;
+import org.apache.websocket.WebSocketConnector;
 
 public class WebsocketReferenceInvoker implements Invoker {
-    
+
     protected Operation operation;
     protected EndpointReference endpoint;
 
@@ -36,16 +43,41 @@ public class WebsocketReferenceInvoker i
 
     public Message invoke(Message msg) {
         try {
-
             return doInvoke(msg);
-            
         } catch (Exception e) {
             throw new RuntimeException(e);
         }
     }
 
     public Message doInvoke(Message msg) {
-        WebsocketServiceInvoker fi = WebsocketStash.getService(endpoint.getBinding().getURI());
-        return fi.invokeService(msg);
+        String componentName = endpoint.getTargetEndpoint().getComponent().getName();
+        String serviceName = endpoint.getTargetEndpoint().getService().getName();
+        String operationName = operation.getName();
+        String uri = endpoint.getBinding().getURI() + "/" + componentName + "/" + serviceName + "/" + operationName;
+        String jsonParams = JSONUtil.encodeRequestParams((Object[]) msg.getBody());
+        String responseJSON = invokeWebSocketRequest(uri, jsonParams);
+        Class<?> returnType = operation.getOutputType().getLogical().get(0).getPhysical();
+        Object response = JSONUtil.decodeResponse(responseJSON, returnType);
+        msg.setBody(response);
+        return msg;
+    }
+
+    private String invokeWebSocketRequest(String uri, String jsonParams) {
+        try {
+            return doInvokeWebSocketRequest(uri, jsonParams);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } catch (URISyntaxException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private String doInvokeWebSocketRequest(String uri, String jsonParams) throws IOException, URISyntaxException {
+        WebSocketConnector connector = new WebSocketConnector();
+        WebSocket<SocketChannel> websocket = connector.connect(new URI(uri), null, "apache-tuscany", null);
+        websocket.sendText(jsonParams);
+        String jsonResponse = websocket.receiveText();
+        websocket.close();
+        return jsonResponse;
     }
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceBindingProvider.java Fri Jul  8 01:34:33 2011
@@ -19,33 +19,125 @@
 
 package org.apache.tuscany.sca.binding.websocket.runtime;
 
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.SocketChannel;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
 import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.provider.ServiceBindingProvider;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.websocket.ServerWebSocket;
+import org.apache.websocket.WebSocket;
+import org.apache.websocket.WebSocketApplication;
+import org.apache.websocket.WebSocketException;
 
 public class WebsocketServiceBindingProvider implements ServiceBindingProvider {
 
     private RuntimeEndpoint endpoint;
-    private InterfaceContract contract;
+    private static ConcurrentMap<String, ServerWebSocket> websocketServers = new ConcurrentHashMap<String, ServerWebSocket>();
 
     public WebsocketServiceBindingProvider(RuntimeEndpoint endpoint) {
         this.endpoint = endpoint;
     }
 
     public void start() {
-        WebsocketStash.addService(endpoint.getBinding().getURI(), new WebsocketServiceInvoker(endpoint));
+        String uri = endpoint.getBinding().getURI();
+        ServerWebSocket server = initWebSocketServerForURI(uri);
+        String component = endpoint.getComponent().getName();
+        String service = endpoint.getService().getName();
+        for (Operation op : getBindingInterfaceContract().getInterface().getOperations()) {
+            String operation = op.getName();
+            server.register("/" + component + "/" + service + "/" + operation, new WebSocketEndpoint(endpoint, op));
+            System.out.println("Registered websocket endpoint for /" + component + "/" + service + "/" + operation);
+        }
+
+    }
+
+    private ServerWebSocket initWebSocketServerForURI(String uri) {
+        ServerWebSocket server = websocketServers.get(uri);
+        if (server == null) {
+            try {
+                server = new ServerWebSocket(new URI(uri));
+                websocketServers.put(uri, server);
+                System.out.println("Starting websocket server at " + uri + "...");
+                new Thread(server).start();
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            } catch (URISyntaxException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return server;
     }
 
     public void stop() {
-        WebsocketStash.removeService(endpoint.getBinding().getURI());
+        if (websocketServers != null) {
+            for (ServerWebSocket server : websocketServers.values()) {
+                try {
+                    server.close();
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+            websocketServers.clear();
+            websocketServers = null;
+        }
     }
 
     public InterfaceContract getBindingInterfaceContract() {
-        return contract;
+        return endpoint.getService().getInterfaceContract();
     }
 
     public boolean supportsOneWayInvocation() {
         return false;
     }
 
+    public class WebSocketEndpoint implements WebSocketApplication<SocketChannel> {
+
+        private RuntimeEndpoint endpoint;
+        private Operation operation;
+
+        public WebSocketEndpoint(RuntimeEndpoint endpoint, Operation operation) {
+            this.endpoint = endpoint;
+            this.operation = operation;
+        }
+
+        @Override
+        public void onConnection(WebSocket<SocketChannel> socket) {
+            // handle request in a non-blocking fashion releasing the server
+            // thread
+            new Thread(new WebsocketServiceInvoker(endpoint, operation, socket)).start();
+        }
+
+        @Override
+        public void onHandshakeError(IOException e) {
+            System.out.println("Handshake error!\n");
+            e.printStackTrace();
+        }
+
+        @Override
+        public String acceptProtocol(String protocol) {
+            // don't accept any subprotocols
+            return null;
+        }
+
+        @Override
+        public boolean acceptOrigin(String origin) {
+            // accept all clients
+            return true;
+        }
+
+        @Override
+        public Map<String, String> acceptExtensions(Map<String, String> headers) throws WebSocketException {
+            // don't accept any extensions
+            return null;
+        }
+
+    }
+
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/main/java/org/apache/tuscany/sca/binding/websocket/runtime/WebsocketServiceInvoker.java Fri Jul  8 01:34:33 2011
@@ -19,22 +19,40 @@
 
 package org.apache.tuscany.sca.binding.websocket.runtime;
 
-import org.apache.tuscany.sca.invocation.Message;
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+import java.nio.channels.SocketChannel;
+
+import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.runtime.RuntimeEndpoint;
+import org.apache.websocket.WebSocket;
 
-public class WebsocketServiceInvoker {
+public class WebsocketServiceInvoker implements Runnable {
 
     private RuntimeEndpoint wire;
-    
-    public WebsocketServiceInvoker(RuntimeEndpoint wire) {
+    private Operation operation;
+    private WebSocket<SocketChannel> websocket;
+
+    public WebsocketServiceInvoker(RuntimeEndpoint wire, Operation operation, WebSocket<SocketChannel> websocket) {
         this.wire = wire;
+        this.operation = operation;
+        this.websocket = websocket;
     }
 
-    /**
-     * Send the request down the wire to invoke the service 
-     */
-    public Message invokeService(Message msg) {
-        return wire.invoke(msg);
+    @Override
+    public void run() {
+        try {
+            String jsonParams = websocket.receiveText();
+            Object[] args = JSONUtil.decodeJsonParamsForOperation(jsonParams, operation);
+            Object response = wire.invoke(operation, args);
+            String jsonResponse = JSONUtil.encodeResponse(response);
+            websocket.sendText(jsonResponse);
+            websocket.close();
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } catch (InvocationTargetException e) {
+            throw new RuntimeException(e);
+        }
     }
-    
+
 }

Modified: tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/helloworld.composite?rev=1144121&r1=1144120&r2=1144121&view=diff
==============================================================================
--- tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/helloworld.composite (original)
+++ tuscany/sca-java-2.x/contrib/modules/binding-websocket/src/test/resources/helloworld.composite Fri Jul  8 01:34:33 2011
@@ -25,15 +25,13 @@
     <component name="HelloWorldComponent">
         <implementation.java class="helloworld.HelloWorldImpl"/>
         <service name="HelloWorldService" >
-            <tuscany:binding.websocket />
+            <tuscany:binding.websocket uri="ws://127.0.0.1:5555" />
         </service>
     </component>   
   
     <component name="HelloWorldClient">
         <implementation.java class="helloworld.HelloWorldClient"/>
-        <reference name="ref" >
-            <tuscany:binding.websocket uri="HelloWorldComponent/HelloWorldService"/>
-        </reference>
+        <reference name="ref" target="HelloWorldComponent/HelloWorldService" />
     </component>   
 
 </composite>