1 7 package org.jboss.remoting.samples.simple; 8 9 import org.jboss.remoting.Client; 10 import org.jboss.remoting.InvokerLocator; 11 12 17 public class SimpleClient 18 { 19 private static String transport = "socket"; 21 private static String host = "localhost"; 22 private static int port = 5400; 23 24 public void makeInvocation(String locatorURI) throws Throwable 25 { 26 InvokerLocator locator = new InvokerLocator(locatorURI); 29 System.out.println("Calling remoting server with locator uri of: " + locatorURI); 30 31 Client remotingClient = new Client(locator); 32 String request = "Do something"; 33 System.out.println("Invoking server with request of '" + request + "'"); 34 Object response = remotingClient.invoke(request); 35 36 System.out.println("Invocation response: " + response); 37 } 38 39 45 public static void main(String [] args) 46 { 47 if(args != null && args.length == 3) 48 { 49 transport = args[0]; 50 host = args[1]; 51 port = Integer.parseInt(args[2]); 52 } 53 String locatorURI = transport + "://" + host + ":" + port; 54 SimpleClient client = new SimpleClient(); 55 try 56 { 57 client.makeInvocation(locatorURI); 58 } 59 catch(Throwable e) 60 { 61 e.printStackTrace(); 62 } 63 } 64 65 66 } | Popular Tags |