public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service RmiIiopInit init = new RmiIiopInit("localhost", 2809); m_nameService = (NamingContext)init.GetService("NameServiceServerRoot"); 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 ejbNameServiceHost = "localhost"; int ejbNameServicePort = 2809; 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 = (NamingContext)init.GetService("NameServiceServerRoot"); 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); } }