public static void Main(string[] args) { try { string nameServiceHost = "localhost"; int nameServicePort = 1050; parseArgs(ref nameServiceHost, ref nameServicePort, args); Console.WriteLine("input the two summands"); Console.WriteLine("sum1:"); double sum1 = Double.Parse(Console.ReadLine()); Console.WriteLine("sum2:"); double sum2 = Double.Parse(Console.ReadLine()); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit(nameServiceHost, nameServicePort); NamingContext nameService = init.GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("ch.elca.iiop.demo.ejbAdder.AdderHome", "") }; // get the reference to the adder-home AdderHome adderHome = (AdderHome)nameService.resolve(name); // create Adder Adder adder = adderHome.create(); // call add double result = adder.add(sum1, sum2); Console.WriteLine("result: " + result); // dispose the ejb adder.remove(); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit("localhost", 7001); m_nameService = init.GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("test", "") }; // get the reference to the test-home TestHome testhome = (TestHome)m_nameService.resolve(name); m_test = testhome.create(); }
public static void Main(string[] args) { try { string nameServiceHost = "localhost"; int nameServicePort = 1050; parseArgs(ref nameServiceHost, ref nameServicePort, args); // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit(nameServiceHost, nameServicePort); NamingContext nameService = init.GetNameService(); // test value object: Console.WriteLine("testing value object"); NameComponent[] name = new NameComponent[] { new NameComponent("ch.elca.iiop.demo.valueObjectDemo.ValueObjDemoHome", "") }; // get the reference to the ValObjectDemo-home ValObjectDemoHome valDemoHome = (ValObjectDemoHome)nameService.resolve(name); // create valObjectDemo ValObjectDemo valDemo = valDemoHome.create(); // call retrieveValObject Console.WriteLine("calling retrieveValObject"); ValObject resultVal = valDemo.retrieveValObject(); Console.WriteLine("test-string: " + resultVal.testString); Console.WriteLine("test-int: " + resultVal.testValue); // call echoValObject Console.WriteLine("calling echoValObject"); ValObject toSend = new ValObjectImpl(); Console.WriteLine("input string: "); toSend.testString = Console.ReadLine(); Console.WriteLine("input int: "); toSend.testValue = Int32.Parse(Console.ReadLine()); Console.WriteLine("result of echo: "); ValObject echo = valDemo.echoValObject(toSend); Console.WriteLine("echo-string: " + echo.testString); Console.WriteLine("echo-value: " + echo.testValue); // Dispose the EJB valDemo.remove(); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public static void Main(string[] args) { try { string ejbNameServiceHost = "localhost"; int ejbNameServicePort = 7001; if (args.Length > 0) { ejbNameServiceHost = args[0]; } if (args.Length > 1) { ejbNameServicePort = Int32.Parse(args[1]); } // the port the callback is listening on int callbackPort = 0; // auto assign if (args.Length > 2) { callbackPort = Int32.Parse(args[2]); } IiopChannel channel = new IiopChannel(callbackPort); ChannelServices.RegisterChannel(channel, false); RmiIiopInit init = new RmiIiopInit(ejbNameServiceHost, ejbNameServicePort); NamingContext nameService = init.GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""), new NameComponent("chatroomHome", "") }; // get the chatroom home interface ChatroomHome home = (ChatroomHome)nameService.resolve(name); Chatroom chatroom = home.create(); Application.Run(new Chatform(chatroom)); } catch (Exception e) { Console.WriteLine("exception: " + e); } }