Example #1
0
        public static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("Please specify the nameservice url either as ior or corbaloc");
            }
            string nameServiceUrl = args[0];

            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            AdderImpl adder     = new AdderImpl();
            string    objectURI = "adder";

            RemotingServices.Marshal(adder, objectURI);

            // publish the adder with an external name service
            NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext),
                                                                                nameServiceUrl);

            NameComponent[] name = new NameComponent[] { new NameComponent("adder") };
            nameService.bind(name, adder);
            Console.WriteLine("server running");
            Console.ReadLine();

            // unpublish with external name service
            nameService.unbind(name);
        }
Example #2
0
        public static void Main(String[] args)
        {
            // register the channel
            int         port = 8087;
            IDictionary dict = new Hashtable();

            dict["port"] = port;
            string endian = "BigEndian";

            if (args.Length > 0)
            {
                endian = args[0];
            }
            dict["endian"] = endian;
            IiopChannel chan = new IiopChannel(dict);

            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test      = new TestServiceImpl();
            string          objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #3
0
        public static void Main(string[] args)
        {
            try {
                string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root";
                // the port the callback is listening on
                int callbackPort = 0; // auto assign
                if (args.Length > 0)
                {
                    nameserviceLoc = args[0];
                }
                if (args.Length > 1)
                {
                    callbackPort = Int32.Parse(args[1]);
                }

                IiopChannel channel = new IiopChannel(callbackPort);
                ChannelServices.RegisterChannel(channel, false);

                NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc);

                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);
            }
        }
Example #4
0
        public static void Main(String[] args)
        {
            // register the channel
            IDictionary props = new Hashtable();

            props[IiopChannel.CHANNEL_NAME_KEY]      = "securedServerIiopChannel";
            props[IiopServerChannel.PORT_KEY]        = "8087";
            props[IiopChannel.TRANSPORT_FACTORY_KEY] =
                "Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";

            props[SslTransportFactory.SERVER_REQUIRED_OPTS]  = "96";
            props[SslTransportFactory.SERVER_SUPPORTED_OPTS] = "96";
            props[SslTransportFactory.SERVER_AUTHENTICATION] =
                "Ch.Elca.Iiop.Security.Ssl.DefaultServerAuthenticationImpl,SSLPlugin";

            props[DefaultServerAuthenticationImpl.SERVER_CERTIFICATE] =
                "5f4abc1aad19e53857be2a4bbec9297091f0082c";

            props[DefaultServerAuthenticationImpl.STORE_LOCATION] = "CurrentUser";

            IiopChannel chan = new IiopChannel(props);

            ChannelServices.RegisterChannel(chan, false);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #5
0
        public static void Main(String[] args) {
            // register the channel            
            IDictionary props = new Hashtable();
            props[IiopChannel.CHANNEL_NAME_KEY] = "securedServerIiopChannel";            
            props[IiopServerChannel.PORT_KEY] = "8087";            
            props[IiopChannel.TRANSPORT_FACTORY_KEY] = 
                "Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";
 
            props[SslTransportFactory.SERVER_REQUIRED_OPTS] = "96";
            props[SslTransportFactory.SERVER_SUPPORTED_OPTS] = "96";
            props[SslTransportFactory.SERVER_AUTHENTICATION] = 
                "Ch.Elca.Iiop.Security.Ssl.DefaultServerAuthenticationImpl,SSLPlugin";

            props[DefaultServerAuthenticationImpl.SERVER_CERTIFICATE] = 
                "5f4abc1aad19e53857be2a4bbec9297091f0082c";                   

            props[DefaultServerAuthenticationImpl.STORE_LOCATION] = "CurrentUser";

            IiopChannel chan = new IiopChannel(props);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #6
0
        public void SetUp()
        {
            m_orb = OrbServices.GetSingleton();

            m_channel = new IiopChannel(TEST_PORT);
            ChannelServices.RegisterChannel(m_channel, false);
        }
Example #7
0
        public static void Main(String[] args) {
            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            TestExceptionServiceImpl testExService = new TestExceptionServiceImpl();
            RemotingServices.Marshal(testExService, "testExService");

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestWellKnownService),
                                                               "testSingleCall",
                                                               WellKnownObjectMode.SingleCall 
                                                              );

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestWellKnownService),
                                                               "testSingletonCall",
                                                               WellKnownObjectMode.Singleton 
                                                              );
            TestContextBoundService contextBound = new TestContextBoundService();
            RemotingServices.Marshal(contextBound, "testContextBound");            

            TestBoxedValuetypeServiceImpl testBoxedService = new TestBoxedValuetypeServiceImpl();
            RemotingServices.Marshal(testBoxedService, "testBoxedService");

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #8
0
        public static void Main(String[] args) {

            IOrbServices orb = OrbServices.GetSingleton();
            TestInterceptorInit testInterceptorInit = new TestInterceptorInit();
            orb.RegisterPortableInterceptorInitalizer(testInterceptorInit);

            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            orb.CompleteInterceptorRegistration();

            TestInterceptorControlService controlService = 
                new TestInterceptorControlService(testInterceptorInit);
            string objectURIControlService = "interceptorControl";
            RemotingServices.Marshal(controlService, objectURIControlService);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #9
0
        public static void Main(String[] args)
        {
            IOrbServices        orb = OrbServices.GetSingleton();
            TestInterceptorInit testInterceptorInit = new TestInterceptorInit();

            orb.RegisterPortableInterceptorInitalizer(testInterceptorInit);

            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            orb.CompleteInterceptorRegistration();

            TestInterceptorControlService controlService =
                new TestInterceptorControlService(testInterceptorInit);
            string objectURIControlService = "interceptorControl";

            RemotingServices.Marshal(controlService, objectURIControlService);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #10
0
 public void TearDown()
 {
     if (m_channel != null)
     {
         ChannelServices.UnregisterChannel(m_channel);
     }
     m_channel = null;
 }
Example #11
0
 public CargoHostEndPoint(string ipAdr, int ipPort)
 {
     IPAddress    = ipAdr;  /*ensure value*/
     IPPort       = ipPort; /*ensure value*/
     _iiopChannel = new IiopChannel(0);
     _ncHost      = new NameComponent[] { new NameComponent("cargo", "context"), new NameComponent("host", "object") };
     _ncXi        = new NameComponent[] { new NameComponent("cargo", "context"), new NameComponent("xi", "object") };
 }
Example #12
0
File: client.cs Project: sun221/ACE
    public static void Main(string[] args)
    {
        if (args.Length != 1)
        {
            Console.WriteLine("Usage: client.exe server.ior");
            return;
        }

        MappingConfiguration.Instance.UseBoxedInAny = false;

        IDictionary props   = new Hashtable();
        IiopChannel channel = new IiopChannel(props);

        ChannelServices.RegisterChannel(channel, false);

        StreamReader sr  = new StreamReader(args[0]);
        string       ior = sr.ReadLine();

        Test test = (Test)RemotingServices.Connect(typeof(Test), ior);

        object[] p = new object[2];
        for (int i = 0; i < p.Length; ++i)
        {
            Container container;
            Inner     inner;
            inner.value1       = 1 + i;
            inner.value2       = 2 + i;
            inner.value3       = 3 + i;
            inner.value4       = 4 + i;
            inner.value5       = 5 + i;
            container.contents = inner;
            p[i] = container;
        }

        try
        {
            p = test.RunTest(p);

            for (int i = 0; i < p.Length; ++i)
            {
                if (p[i] is Container)
                {
                    Inner inner = (Inner)((Container)p[i]).contents;
                    Console.WriteLine("[{0}]: {1} {2} {3} {4} {5}", i,
                                      inner.value1, inner.value2, inner.value3, inner.value4, inner.value5);
                }
            }
            test.shutdown();
        }
        catch (Exception ex)
        {
            Console.WriteLine("Invoke failed: {0}", ex.ToString());
        }
    }
Example #13
0
        public void SetupEnvironment()
        {
            // register the channel
            IDictionary props = new Hashtable();

            props[IiopServerChannel.PORT_KEY] = 0;
            m_channel = new IiopChannel(props);
            ChannelServices.RegisterChannel(m_channel, false);
            // get the reference to the test-service
            m_testService = (TestService)RemotingServices.Connect(typeof(TestService), "corbaloc:iiop:1.2@localhost:8087/test");
        }
Example #14
0
        public static void Main(String[] args) {
            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #15
0
        public void RebindToNameService()
        {
            try { _NameService.rebind(_ncXi, new XiManagerCallback()); }
            catch
            {
                _NameService = null;
#if false
                // HACK! ChannelServices.UnregisterChannel hangs.
                ChannelServices.UnregisterChannel(_IiopChannel);
#endif
                _IiopChannel = null;
                throw;
            }
        }
Example #16
0
        public static void Main(String[] args) {
            InitCustomMapping();

            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test = new TestServiceImpl();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Console.ReadLine();
        }
Example #17
0
        public static void Main(String[] args) {
            // register the channel
            int port = 8087;
            IDictionary properties = new Hashtable();
            properties[IiopServerChannel.PORT_KEY] = port;
            IiopChannel chan = new IiopChannel(properties);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #18
0
        public HostComm()
        {
            String caseManagerIP   = (string)ConfigurationManager.AppSettings["host"];
            Int32  caseManagerPort = Int32.Parse(ConfigurationManager.AppSettings["port"]);

            //connected with host manager
            m_Channel = new IiopChannel(0);
            ChannelServices.RegisterChannel(m_Channel, false);

            CorbaInit m_Init = CorbaInit.GetInit();

            m_NameService = m_Init.GetNameService(caseManagerIP, (int)caseManagerPort);

            HostConnThread = new Thread(new ThreadStart(HostConnState));
        }
Example #19
0
        public static void Main(string[] args)
        {
            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            AdderImpl adder     = new AdderImpl();
            string    objectURI = "adder";

            RemotingServices.Marshal(adder, objectURI);

            Console.WriteLine("server running");
            Console.ReadLine();
        }
Example #20
0
        public static void Main(String[] args)
        {
            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test      = new TestServiceImpl();
            string          objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Console.ReadLine();
        }
Example #21
0
 public void SetupEnvironment()
 {
     // register the channel
     if (m_channel == null)
     {
         // the remote proxy for this url is bound to a certain sink chain for some time ->
         // don't recreate channel; otherwise, is no more bidirectional for another run.
         IDictionary props = new Hashtable();
         props[IiopServerChannel.PORT_KEY] = 0;
         props[IiopChannel.BIDIR_KEY]      = true;
         m_channel = new IiopChannel(props);
     }
     ChannelServices.RegisterChannel(m_channel, false);
     // get the reference to the test-service
     m_testService = (TestService)RemotingServices.Connect(typeof(TestService), "corbaloc:iiop:1.2@localhost:8087/test");
 }
Example #22
0
        public static void Main(String[] args) {
            // Some tests on client side like TestIsACall require marshalling to be done using concrete type and not
            // exposed interface:
            omg.org.CORBA.OrbServices.GetSingleton().SerializerFactoryConfig.ObjSerializationUseConcreteType = true;
            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test = new TestServiceImpl();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #23
0
        public static void Main(String[] args) {

            IOrbServices orb = OrbServices.GetSingleton();
            orb.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16);

            // register the channel
            int port = 8087;
            IiopChannel chan = new IiopChannel(port);
            ChannelServices.RegisterChannel(chan, false);

            TestService test = new TestService();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);
            
            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #24
0
        public static void Main(String[] args)
        {
            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            TestExceptionServiceImpl testExService = new TestExceptionServiceImpl();

            RemotingServices.Marshal(testExService, "testExService");

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestWellKnownService),
                                                               "testSingleCall",
                                                               WellKnownObjectMode.SingleCall
                                                               );

            RemotingConfiguration.RegisterWellKnownServiceType(typeof(TestWellKnownService),
                                                               "testSingletonCall",
                                                               WellKnownObjectMode.Singleton
                                                               );
            TestContextBoundService contextBound = new TestContextBoundService();

            RemotingServices.Marshal(contextBound, "testContextBound");

            TestIdlTypesServiceImpl testIdlTypesService = new TestIdlTypesServiceImpl();

            RemotingServices.Marshal(testIdlTypesService, "testIdlTypesService");

            TestOneWayServiceImpl testOneWayService = new TestOneWayServiceImpl();

            RemotingServices.Marshal(testOneWayService, "testOneWayService");

            TestServiceWithCallbackImpl testServiceWithCallback = new TestServiceWithCallbackImpl();

            RemotingServices.Marshal(testServiceWithCallback, "testServiceWithCallback");

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #25
0
        public static void Main(String[] args) {
            // register the channel
            IDictionary properties = new Hashtable();
            properties[IiopServerChannel.PORT_KEY] = 8087;
            properties[IiopServerChannel.SERVERTHREADS_MAX_PER_CONNECTION_KEY] = 20;            
            IiopChannel chan = new IiopChannel(properties);
            ChannelServices.RegisterChannel(chan, false);

            TestService test1 = new TestService();
            string objectURI1 = "test1";
            RemotingServices.Marshal(test1, objectURI1);
            TestService test2 = new TestService();
            string objectURI2 = "test2";
            RemotingServices.Marshal(test2, objectURI2);

            Console.WriteLine("Server running. Press any key to stop....");
            Console.ReadLine();
        }
Example #26
0
        public static void Main(string[] args)
        {
            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            // publish the storage service manager
            Manager manager   = new Manager();
            string  objectURI = "storagemanager";

            RemotingServices.Marshal(manager, objectURI);

            Console.WriteLine("server running");
            Console.WriteLine("press any key to terminate....");
            Console.ReadLine();
        }
Example #27
0
        public void Close()
        {
            IsConnected = false;
            try
            {
                if (_NameService != null)
                {
                    _NameService.unbind(_ncXi);
                }
            }
            catch { }
            finally { _NameService = null; }
#if false
            // HACK! ChannelServices.UnregisterChannel hangs.
            ChannelServices.UnregisterChannel(_IiopChannel);
#endif
            _IiopChannel = null;
        }
Example #28
0
        public void SetupEnvironment(string serviceUrl, string nsUrl, NameComponent[] name,
                                     string endian)
        {
            // register the channel
            int         port = 0;
            IDictionary dict = new Hashtable();

            dict["port"]   = port;
            dict["endian"] = endian;
            m_channel      = new IiopChannel(dict);
            ChannelServices.RegisterChannel(m_channel, false);

            m_testService       = (TestService)RemotingServices.Connect(typeof(TestService), serviceUrl);
            m_testServiceIorUrl = (TestService)
                                  omg.org.CORBA.OrbServices.GetSingleton().string_to_object(serviceUrl);

            m_testServiceFromNs = TryGetServiceFromNs(nsUrl, name);
        }
Example #29
0
        /**
         * Default constructor. This will attempt to establish connection
         * with the test archive. It's better to perform the initialization
         * here instead of in Page_Load since Page_Load can be invoked many
         * times during a single visit to a page.
         */
        public Tests()
        {
            try
            {
                // Register the IiopChannel with the framework.
                IiopChannel channel = new IiopChannel();
                ChannelServices.RegisterChannel(channel, false);
            }
            catch (RemotingException)
            {
            }

            // Configure the address of the test archive.
            string address  = ConfigurationManager.AppSettings["cuts.archive.address"];
            string corbaloc = String.Format("corbaloc:iiop:{0}/CUTS/TestArchive", address);

            // Connect to the test archive.
            this.archive_ = (CUTS.TestArchive)RemotingServices.Connect(typeof(CUTS.TestArchive), corbaloc);
        }
Example #30
0
        public static void Main(String[] args)
        {
            // Some tests on client side like TestIsACall require marshalling to be done using concrete type and not
            // exposed interface:
            omg.org.CORBA.OrbServices.GetSingleton().SerializerFactoryConfig.ObjSerializationUseConcreteType = true;
            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test      = new TestServiceImpl();
            string          objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #31
0
        public static void Main(String[] args)
        {
            // register the channel
            int         port       = 8087;
            IDictionary properties = new Hashtable();

            properties[IiopServerChannel.PORT_KEY] = port;
            IiopChannel chan = new IiopChannel(properties);

            ChannelServices.RegisterChannel(chan, false);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #32
0
        public void TestLocationForwardOnIsA()
        {
            // tests location forward, if we forward on is_a call
            IiopChannel chan = new IiopChannel(8090);

            ChannelServices.RegisterChannel(chan, false);
            // publish location fwd target
            TestService target       = new TestService();
            string      fwdTargetUri = "testuriFwdForIsA";

            RemotingServices.Marshal(target, fwdTargetUri);

            // request msg the reply is for
            MethodInfo methodToCall = typeof(omg.org.CORBA.IObject).GetMethod("_is_a");

            object[]    args       = new object[] { "IDL:Ch/Elca/Iiop/Tests/TestService:1.0" };
            string      origUrl    = "iiop://localhost:8090/testuri"; // Giop 1.2 will be used because no version spec in uri
            TestMessage requestMsg = new TestMessage(methodToCall, args, origUrl);
            // prepare connection desc
            GiopClientConnectionDesc conDesc = new GiopClientConnectionDesc(null, null, new GiopRequestNumberGenerator(), null);

            try {
                Stream locFwdStream = PrepareLocationFwdStream("localhost", 8090,
                                                               target);

                IMessage resultMsg =
                    m_handler.ParseIncomingReplyMessage(locFwdStream, requestMsg, conDesc);
                MarshalByRefObject fwdToTarget;
                bool isFwd = GiopMessageHandler.IsLocationForward(resultMsg, out fwdToTarget);
                Assert.IsTrue(isFwd, "is a forward?");
                Assert.NotNull(fwdToTarget, "new target reference null?");
                ReturnMessage result = (ReturnMessage)
                                       m_handler.ForwardRequest(requestMsg, fwdToTarget);
                Assert.AreEqual(true, result.ReturnValue);
                Assert.AreEqual(0, result.OutArgCount);
            } finally {
                // unpublish target + channel
                RemotingServices.Disconnect(target);
                chan.StopListening(null);
                ChannelServices.UnregisterChannel(chan);
            }
        }
Example #33
0
        public static void Main(String[] args)
        {
            IOrbServices orb = OrbServices.GetSingleton();

            orb.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16);

            // register the channel
            int         port = 8087;
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            TestService test      = new TestService();
            string      objectURI = "test";

            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #34
0
        public static void Main(String[] args) {
            // register the channel
            int port = 8087;
            IDictionary dict = new Hashtable();
            dict["port"] = port;
            string endian = "BigEndian";
            if (args.Length > 0) {
                endian = args[0];
            }
            dict["endian"] = endian;
            IiopChannel chan = new IiopChannel(dict);
            ChannelServices.RegisterChannel(chan, false);

            TestServiceImpl test = new TestServiceImpl();
            string objectURI = "test";
            RemotingServices.Marshal(test, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #35
0
        public static void Main(string[] args)
        {
            // register the channel
            IDictionary props = new Hashtable();

            props[IiopChannel.CHANNEL_NAME_KEY]      = "securedServerIiopChannel";
            props[IiopServerChannel.PORT_KEY]        = "8087";
            props[IiopChannel.TRANSPORT_FACTORY_KEY] =
                "Ch.Elca.Iiop.Security.Ssl.SslTransportFactory,SSLPlugin";

            props[SslTransportFactory.SERVER_REQUIRED_OPTS]  = "96";
            props[SslTransportFactory.SERVER_SUPPORTED_OPTS] = "96";
            props[SslTransportFactory.SERVER_AUTHENTICATION] =
                "Ch.Elca.Iiop.Security.Ssl.DefaultServerAuthenticationImpl,SSLPlugin";

            props[DefaultServerAuthenticationImpl.SERVER_CERTIFICATE] =
                "5f4abc1aad19e53857be2a4bbec9297091f0082c";
            props[DefaultServerAuthenticationImpl.STORE_LOCATION] = "CurrentUser";

            IiopChannel chan = new IiopChannel(props);

            ChannelServices.RegisterChannel(chan, false);

            AdderImpl adder     = new AdderImpl();
            string    objectURI = "adder";

            RemotingServices.Marshal(adder, objectURI);

            // write out ior to file
            OrbServices orb = OrbServices.GetSingleton();
            string      ior = orb.object_to_string(adder);

            TextWriter writer = new StreamWriter(@"ior");

            writer.WriteLine(ior);
            writer.Close();
            Console.WriteLine("server ior: " + ior.ToString());

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #36
0
        public static void Main(string[] args)
        {
            // register the channel
            int port = 8087;

            if (args.Length > 0)
            {
                port = Int32.Parse(args[0]);
            }
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            ChatroomImpl chatroom  = new ChatroomImpl();
            string       objectURI = "chatroom";

            RemotingServices.Marshal(chatroom, objectURI);

            Console.WriteLine("server running");
            Console.ReadLine();
        }
Example #37
0
        public static void Main(string[] args)
        {
            // register the channel
            int port = 8087;

            if (args.Length > 0)
            {
                port = Int32.Parse(args[0]);
            }
            IiopChannel chan = new IiopChannel(port);

            ChannelServices.RegisterChannel(chan, false);

            AdderImpl adder     = new AdderImpl();
            string    objectURI = "adder";

            RemotingServices.Marshal(adder, objectURI);

            Console.WriteLine("server running");
            Thread.Sleep(Timeout.Infinite);
        }
Example #38
0
        public void SetupEnvironment()
        {
            MappingConfiguration.Instance.UseBoxedInAny = false; // disable boxing of string/arrays in any's
            // register the channel
            // register the channel
            if (m_channel == null)
            {
                // the remote proxy for this url is bound to a certain sink chain for some time ->
                // don't recreate channel; otherwise, is no more bidirectional for another run.
                IDictionary props = new Hashtable();
                props[IiopServerChannel.PORT_KEY] = 0;
                props[IiopChannel.BIDIR_KEY]      = true;
                m_channel = new IiopChannel(props);
            }
            ChannelServices.RegisterChannel(m_channel, false);

            NamingContext nameService = GetNameService();

            NameComponent[] name = new NameComponent[] { new NameComponent("test", "") };
            // get the reference to the test-service
            m_testService = (TestService)nameService.resolve(name);
        }
Example #39
0
        static void Main(string[] args)
        {
            Console.Title = "SERVER";
            try
            {
                int         serverPort = 1234;
                IiopChannel channel    = new IiopChannel(serverPort);
                ChannelServices.RegisterChannel(channel);

                EmployeeRepository repository = new EmployeeRepository();
                string             objectURI  = "hello";
                RemotingServices.Marshal(repository, objectURI);

                Console.WriteLine("Endpoint started");
                Console.WriteLine("Press any key to exit");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            Console.ReadKey();
        }
Example #40
0
    /// <summary>
    /// CargoHostInterface.  This is the constructor for this
    /// class. It publishes XI and SNM objects for CargoHost to receive notifications
    ///
    /// Arguments:
    ///
    ///
    ///
    ///     none
    /// Exceptions:
    ///     none
    /// Return:
    ///     none
    /// </summary>
    public CargoHostInterface()
    {
        try
        {
            // register the channel
            m_Channel = new IiopChannel(0); // assign port automatically
            ChannelServices.RegisterChannel(m_Channel, false);

            CorbaInit m_Init = CorbaInit.GetInit();

            string CORBA_NS_Host = (string)ConfigurationManager.AppSettings["host"];
            Int32  CORBA_NS_Port = Int32.Parse(ConfigurationManager.AppSettings["port"]);

            m_NameService = m_Init.GetNameService(CORBA_NS_Host, (int)CORBA_NS_Port);

            xrayInterface = new XI_Impl();
            NameComponent[] ncXI = GetNameComponent(xrayInterface, "xi");
        }
        catch (Exception e)
        {
            MessageBox.Show(e.StackTrace);
            return;
        }

        // Get Logger from CargoHost
        try
        {
            m_CargoHostLogger = (l3.cargo.corba.Logger)m_NameService.resolve(m_ncLogger);
        }
        catch (CargoException e1)
        {
            MessageBox.Show(e1.error_msg);
        }
        catch (omg.org.CORBA.AbstractCORBASystemException a)
        {
            MessageBox.Show(a.Message);
        }
    }