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