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 Portugol iniciar() { string caminhoJARs = Path.GetDirectoryName(Application.ExecutablePath) + "\\".Replace("\n", ""); string portugol_integracao_jar = caminhoJARs + "portugol-integracao.jar"; ProcessStartInfo construtorProcesso = new ProcessStartInfo(); construtorProcesso.FileName = "java"; construtorProcesso.Arguments = "-jar \"" + portugol_integracao_jar + "\""; construtorProcesso.CreateNoWindow = false; construtorProcesso.WindowStyle = ProcessWindowStyle.Hidden; Process.Start(construtorProcesso); Thread.Sleep(5000); canal = new IiopChannel(PORTA_PADRAO_CALLBACK); ChannelServices.RegisterChannel(canal, false); CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService("localhost", PORTA_PADRAO); NameComponent[] name = new NameComponent[] { new NameComponent("Portugol", "") }; portugol = (Portugol) nameService.resolve(name); return portugol; }
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); // access COS nameing service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("adder", "") }; // get the reference to the adder Adder adder = (Adder)nameService.resolve(name); // call add double result = adder.add(sum1, sum2); Console.WriteLine("result: " + result); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
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); } }
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); }
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") }; }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); 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); }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), "corbaloc::localhost:11456/NameService"); NameComponent[] name = new NameComponent[] { new NameComponent("test", "") }; // get the reference to the test-service m_testService = (TestService)nameService.resolve(name); }
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 void SetupEnvironment() { SetupSslChannel(); // access COS nameing service string nameserviceLoc = "corbaloc:iiop-ssl:localhost:3529/JBoss/Naming/root"; m_nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); 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 void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root"; m_nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("testForwarder", "") }; // get the reference to the test-home TestHomeFwd testhome = (TestHomeFwd) m_nameService.resolve(name); m_test = testhome.create(); }
public static void Main(string[] args) { try { // register the channel IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel); Object obj = new Object(); try { // access COS naming Service NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), "corbaloc::localhost:2809/NameService"); Console.WriteLine("Got reference to nameService"); // get the reference to the Graph NameComponent[] name = new NameComponent[] { new NameComponent("Foo", "Test") }; Console.WriteLine("About to resolve Foo.Test"); obj = (DataFlowGraph) nameService.resolve(name); Console.WriteLine("Got reference to graph"); } catch (NotFound e) { Console.WriteLine("Could not find graph in NameService"); return; } catch (TRANSIENT e) { Console.WriteLine("Could not contact NameService"); return; } if (obj == null) { Console.WriteLine("Reference to graph is null..."); return; } DataFlowGraph graph = (DataFlowGraph) obj; KeyValuePair[] sink_attributes = new KeyValuePair[] { new KeyValuePair("name", "CORBA.Sink01") }; Console.WriteLine("About to create node"); Node sink = (Node) graph.create_node("CORBASink", sink_attributes); Console.WriteLine("Created CORBA sink node"); Node[] nodes = graph.get_nodes(); foreach (Node n in nodes) { Console.WriteLine(n.get_attribute("ID")); } } catch (NotFound e) { Console.WriteLine("Could not find graph in NameService"); } catch (TRANSIENT e) { Console.WriteLine("Could not contact graph"); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
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); }
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 void SetupEnvironment() { MappingConfiguration.Instance.UseBoxedInAny = false; // disable boxing of string/arrays in any's // register the channel m_channel = new IiopClientChannel(); 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); NameComponent[] nameInternal = new NameComponent[] { new NameComponent("testInternal", "") }; // get the reference to a service with a server-side only interface inherited from a public one m_testServiceInternalIf = (TestSimpleServicePublic)nameService.resolve(nameInternal); m_orb = OrbServices.GetSingleton(); }
public void SetupEnvironment() { // register the channel m_channel = new IiopClientChannel(); ChannelServices.RegisterChannel(m_channel, false); // access COS nameing service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService("localhost", 1050); NameComponent[] name = new NameComponent[] { new NameComponent("testPlugin", "") }; // get the reference to the test-service m_testService = (TestService)nameService.resolve(name); try { CustomMapperRegistry reg = CustomMapperRegistry.GetSingleton(); reg.AddMappingsFromFile(new FileInfo("customMapping.xml")); reg.AddMappingsFromFile(new FileInfo("customMappingTest.xml")); } catch (Exception e) { Console.WriteLine("custom mapper not loadable: " + e); throw 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); } }
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 naming service CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("service", "") }; // get the reference to the adder Service service = (Service)nameService.resolve(name); // call fail service.fail(); } catch (CustomEx je) { Console.WriteLine("Java-side exception: {0}\nReason: {1}", je.value.message, je.value.reason); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
public static void Main(string[] args) { try { string nameserviceLoc = "corbaloc::localhost:3528/JBoss/Naming/root"; if (args.Length > 0) { nameserviceLoc = args[0]; } IiopClientChannel channel = new IiopClientChannel(); ChannelServices.RegisterChannel(channel, false); NamingContext nameService = (NamingContext)RemotingServices.Connect(typeof(NamingContext), nameserviceLoc); NameComponent[] name = new NameComponent[] { new NameComponent("demo", ""), new NameComponent("commandTargetHome", "") }; // get the command target home interface CommandTargetHome home = (CommandTargetHome) nameService.resolve(name); CommandTarget commandTarget = home.create(); Application.Run(new Commandform(commandTarget)); } catch (Exception e) { Console.WriteLine("exception: " + e); } }
/// <summary>create a name for the name-components</summary> private static string CreateNameForNameComponents(NameComponent[] nameComponents) { StringBuilder builder = new StringBuilder(); foreach (NameComponent component in nameComponents) { if (builder.Length != 0) { builder.Append('/'); } builder.Append(component.id); if (!string.IsNullOrEmpty(component.kind)) { builder.Append('.').Append(component.kind); } } return builder.ToString(); }
private static MarshalByRefObject GetObjectRegisteredAtUri(string uri, NameComponent[] nameComponents) { // this is not nice, because it does circument internal on IdentityHolder-class Debug.WriteLine("get registeredObject: " + uri); Assembly remotingAssembly = Assembly.Load("mscorlib"); if (remotingAssembly == null) { throw new INTERNAL(16001, CompletionStatus.Completed_MayBe); } Type identityHolderType = remotingAssembly.GetType("System.Runtime.Remoting.IdentityHolder"); if (identityHolderType == null) { throw new INTERNAL(16002, CompletionStatus.Completed_MayBe); } // identityHolder class, manages the published remote objects // get the resolveUri-method to get the Identity for the URI MethodInfo resolveIdMethod = identityHolderType.GetMethod("ResolveIdentity", BindingFlags.Static | BindingFlags.NonPublic); if (resolveIdMethod == null) { throw new INTERNAL(16003, CompletionStatus.Completed_MayBe); } // now call resolve-method: object identity = resolveIdMethod.Invoke(null, new object[] { uri } ); if (identity == null) { throw new NamingContext_package.NotFound(NamingContext_package.NotFoundReason.missing_node, nameComponents); } // now get the object from the identity Type identityType = remotingAssembly.GetType("System.Runtime.Remoting.Identity"); if (identityType == null) { throw new INTERNAL(16004, CompletionStatus.Completed_MayBe); } // property TPOrObject holds the object, therefor access this property PropertyInfo tpOrObjProp = identityType.GetProperty("TPOrObject", BindingFlags.Instance | BindingFlags.NonPublic); if (tpOrObjProp == null) { throw new INTERNAL(16005, CompletionStatus.Completed_MayBe); } MarshalByRefObject result = (MarshalByRefObject)tpOrObjProp.GetValue(identity, null); if (result == null) { throw new INTERNAL(16006, CompletionStatus.Completed_MayBe); } return result; }
private RtecEventChannelAdmin.EventChannel ResolveEventChannel(NamingContext nameService) { NameComponent[] name = new NameComponent[] { new NameComponent("EventService", "") }; //Downcast the object reference to an EventChannel reference RtecEventChannelAdmin.EventChannel ec = (RtecEventChannelAdmin.EventChannel)nameService.resolve(name); return ec; }
static void Main(string[] args) { CorbaInit orb = CorbaInit.GetInit(); IiopClientChannel clientChannel = new IiopClientChannel(); ChannelServices.RegisterChannel(clientChannel,false); DFS.DFSaccess dfsclient = null; while (true) { Console.WriteLine("Select connection method:"); Console.WriteLine("1. Direct - enter object corbaloc name"); Console.WriteLine("2. Direct - enter object IOR"); Console.WriteLine("3. Using Nameservice - enter nameservice host and port"); try{ string response = Console.ReadLine(); int means = Int32.Parse(response); switch (means) { case 1: Console.WriteLine("Enter corbaloc url:"); string retprom = Console.ReadLine(); retprom = "corbaloc:iiop:localhost:8807/DFSAccess"; dfsclient = RemotingServices.Connect(typeof(DFS.DFSaccess), retprom) as DFS.DFSaccess;break; case 2: Console.WriteLine("Enter ior:"); string retior = Console.ReadLine(); dfsclient = RemotingServices.Connect(typeof(DFS.DFSaccess), retior) as DFS.DFSaccess;break; case 3: Console.WriteLine("Enter nameservice host:"); string namhost = Console.ReadLine(); Console.WriteLine("Enter nameservice port:"); int namport = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter object name:"); string objname = Console.ReadLine(); NamingContext nameService = orb.GetNameService(namhost, namport); Console.ReadLine(); Console.WriteLine("Aquired NAMING SERVICE"); NameComponent[] name = new NameComponent[] { new NameComponent(objname) }; dfsclient = (DFS.DFSaccess)nameService.resolve(name);break; default: Console.WriteLine("BadChoice");break; } } catch (Exception e) { Console.WriteLine("Couldnt connect"); Console.WriteLine( e.ToString() ); } if ( dfsclient != null ) break; } bool done = false; do { Console.WriteLine("Issue Command:"); Console.WriteLine("1. Add File"); Console.WriteLine("2. RemoveFile"); Console.WriteLine("3. Get File List"); Console.WriteLine("4. Get File"); Console.WriteLine("5. Exit"); try { string response = Console.ReadLine(); int means = Int32.Parse(response); switch (means) { case 1: Console.WriteLine("Enter File Name:"); string fname = Console.ReadLine(); Console.WriteLine("Enter File Contents:"); byte[] cnt = System.Text.Encoding.UTF8.GetBytes(Console.ReadLine()); dfsclient.addFile(fname, cnt); break; case 2: Console.WriteLine("Enter File Name:"); string fnamer = Console.ReadLine(); dfsclient.removeFile(fnamer);break; case 3: foreach (var item in dfsclient.getFileList()) { Console.WriteLine(item); }break; case 4: Console.WriteLine("Enter File Name:"); string fnamed = Console.ReadLine(); Console.WriteLine(System.Text.Encoding.UTF8.GetString(dfsclient.getFile(fnamed)));break; case 5: done = true;break; default: Console.WriteLine("BadChoice"); break; } } catch (Exception e) { Console.WriteLine("Couldnt connect"); Console.WriteLine(e.ToString()); } } while (!done); }
public void TestNonExistent() { NamingContext nameService = GetNameService(); NameComponent[] name = new NameComponent[] { new NameComponent("testXYZ", "") }; // get the reference to non-existent service m_testService = (TestService)nameService.resolve(name); }
private bool submit_CID_objects() { try { string regAppID = utility.getParameter("CID_RFG_application_id"); #region if an EJB is provided - similar to http://iiop-net.sourceforge.net //register the channel if not already registered bool registered = false; for (int i = 0; i < ChannelServices.RegisteredChannels.Length; i++) { if (ChannelServices.RegisteredChannels[i].ChannelName == "IIOPChannel") { registered = true; } } if (!registered) { IiopClientChannel channel = new IiopClientChannel(); //.NET 1.1: ChannelServices.RegisterChannel(channel); ChannelServices.RegisterChannel(channel, false); } // get the naming service //old RmiIiopInit init = new RmiIiopInit("ccecidut04.cce.hp.com", 7302); string cidHost = utility.getParameter("CID_nameService_host"); int cidPort = Int32.Parse(utility.getParameter("CID_nameService_port")); //RmiIiopInit init = new RmiIiopInit("sasuit1cl3.austin.hp.com", 22777); RmiIiopInit init = new RmiIiopInit(cidHost, cidPort); NamingContext nameService = init.GetNameService(); //NameComponent[] name = new NameComponent[] { new NameComponent("com.hp.cid.ejb.identity.IdHome", "") }; //NameComponent[] name = new NameComponent[] { new NameComponent("com.hp.cid.ejb.identity", "") }; //NameComponent[] name = new NameComponent[] { new NameComponent("com.hp.cid.identity", "") }; //NameComponent[] name = new NameComponent[] { new NameComponent("identity", "") }; //NameComponent[] name = new NameComponent[] { new NameComponent("identity_ejb", "") }; NameComponent[] name = new NameComponent[] { new NameComponent(utility.getParameter("CID_nameServiceID"), "") }; //IdHome idHome = (IdHome)nameService.resolve(name); //Id identObj = idHome.create(); Id identObj = (Id)nameService.resolve(name); #endregion #region if an EJB is provided - similar to www.codeproject.com // doesn't work!! // //register the channel // IiopClientChannel channel = new IiopClientChannel(); // ChannelServices.RegisterChannel(channel); // // // get the naming service // RmiIiopInit init = new RmiIiopInit("ccecidut04.cce.hp.com", 7302); // NamingContext nameService = (NamingContext)init.GetService("NameServiceServerRoot"); // // NameComponent[] name = new NameComponent[] { new NameComponent("identity_ejb", "") }; // Id identObj = (Id)nameService.resolve(name); #endregion #region if a nameing server is used // string nameServiceHost = utility.getParameter("CID_nameService_host"); // int nameServicePort = int.Parse(utility.getParameter("CID_nameService_port")); // // //access COS nameing service // CorbaInit init = CorbaInit.GetInit(); // // NamingContext nameService = init.GetNameService(nameServiceHost, nameServicePort); // NameComponent[] name = new NameComponent[] {new NameComponent("identity", "")}; // // //get the reference to the serive class // Id identObj = (Id)nameService.resolve(name); #endregion #region if an IOR file is used //string ior = utility.getParameter("CID_IOR"); //string ior = "iiop://ccecidut04.cce.hp.com:7302/identity_ejb"; //get the reference to the serive class //Id identObj = (Id)RemotingServices.Connect(typeof(Id), ior); #endregion #region call getIDPlus bool returnAddressIdFlag = true; bool returnAddressFlag = true; bool returnPrivacyFlag = true; bool single_submit = false; for(int i = 0; i < cid_records.Length; i++) { CidPerson hpCust = cid_records[i]; single_submit = false; if (!cid_results[i].submitted) { try { //bool result = identObj.verifyID("2100000002006857", regAppID); //string id = ""; //me susann old: "2100000002006857" //object o = identObj.getPerson("0000000001268848", regAppID); //CidPerson me_susann = identObj.getPerson(id, regAppID); CidNumberObject returned_cid = identObj.getIDPlus(hpCust, "", returnAddressIdFlag, returnAddressFlag, returnPrivacyFlag); single_submit = (returned_cid.personIdentifier.Length > 0); cid_results[i].CidIdentifier = String.Format("infoClient: getIDPlus() returns = {0}{1}", returned_cid.personIdentifier, utility.newline); } catch (Exception ex) { #region //log OMG CORBA exception, connection or cidexception error? string exceptionMessage = ""; if (ex.GetType().ToString() == "com.hp.cid.exceptions.CidException") { com.hp.cid.exceptions.CidException cidEx = (com.hp.cid.exceptions.CidException)ex; exceptionMessage = GetCidExceptionString(cidEx); } else { exceptionMessage = ex.ToString(); } cid_results[i].FailureMessage = exceptionMessage; #endregion single_submit = false; } cid_results[i].submitted = single_submit; } } #endregion return true; } catch (Exception ex) { //log connection error ? //wrong IiopClientChannel channel = new IiopClientChannel(); //wrong ChannelServices.UnregisterChannel(channel); //for (int i = 0; i < ChannelServices.RegisteredChannels.Length; i++) //{ // ChannelServices.UnregisterChannel(ChannelServices.RegisteredChannels[i]); //} string exception = ex.ToString(); return false; } }
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); }
public void TestSendRefOfAProxy() { NameComponent[] name = new NameComponent[] { new NameComponent("IntegrationTest", ""), new NameComponent("intadder", "") }; // get the reference to the intadder-home IntAdderHome adderhome = (IntAdderHome) m_nameService.resolve(name); Assertion.AssertNotNull("int adder bean home not found!", adderhome); IntAdder adder = adderhome.create(); System.Int32 arg1 = 1; System.Int32 arg2 = 2; System.Int32 result = m_test.AddWithAdder(adder, arg1, arg2); Assertion.AssertEquals((System.Int32) arg1 + arg2, result); }
private void RetrieveChatRoom(string nameServiceHost, int nameServicePort) { CorbaInit init = CorbaInit.GetInit(); NamingContext nameService = (NamingContext)init.GetNameService(nameServiceHost, nameServicePort); NameComponent[] name = new NameComponent[] { new NameComponent("chatroom", "") }; // get the chatroom m_chatroom = (IChatroom) nameService.resolve(name); }
/// <summary> /// creates a name, which should be passed to resolve method on naming context, /// for the given jndi name /// </summary> public static NameComponent[] CreateNameForJNDI(string jndiName) { if (jndiName == null) { throw new ArgumentException("jndi name must be != null"); } string[] nameParts = jndiName.Split('.'); NameComponent[] result = new NameComponent[nameParts.Length]; for (int i = 0; i < nameParts.Length; i++) { result[i] = new NameComponent(nameParts[i]); } return result; }
static void Main(string[] args) { CorbaInit orb = CorbaInit.GetInit(); IiopClientChannel clientChannel = new IiopClientChannel(); ChannelServices.RegisterChannel(clientChannel,false); DFS.DFSmanager dfsmanag = null; while (true) { Console.WriteLine("Select connection method:"); Console.WriteLine("1. Direct - enter object corbaloc name"); Console.WriteLine("2. Direct - enter object IOR"); Console.WriteLine("3. Using Nameservice - enter nameservice host and port"); try{ string response = Console.ReadLine(); int means = Int32.Parse(response); switch (means) { case 1: Console.WriteLine("Enter corbaloc url:"); string retprom = Console.ReadLine(); retprom = "corbaloc:iiop:localhost:8807/DFSManager"; dfsmanag = RemotingServices.Connect(typeof(DFS.DFSmanager), retprom) as DFS.DFSmanager;break; case 2: Console.WriteLine("Enter ior:"); string retior = Console.ReadLine(); dfsmanag = RemotingServices.Connect(typeof(DFS.DFSmanager), retior) as DFS.DFSmanager;break; case 3: Console.WriteLine("Enter nameservice host:"); string namhost = Console.ReadLine(); Console.WriteLine("Enter nameservice port:"); int namport = Int32.Parse(Console.ReadLine()); Console.WriteLine("Enter object name:"); string objname = Console.ReadLine(); NamingContext nameService = orb.GetNameService(namhost, namport); NameComponent[] name = new NameComponent[] { new NameComponent(objname) }; dfsmanag = (DFS.DFSmanager)nameService.resolve(name);break; default: Console.WriteLine("BadChoice");break; } } catch (Exception e) { Console.WriteLine("Couldnt connect"); Console.WriteLine( e.ToString() ); } if ( dfsmanag != null ) break; } bool done = false; do { Console.WriteLine("Issue Command:"); Console.WriteLine("1. Add Node"); Console.WriteLine("2. Remove Node"); Console.WriteLine("3. List Nodes"); Console.WriteLine("4. Shutdown server"); Console.WriteLine("5. Exit"); try { string response = Console.ReadLine(); int means = Int32.Parse(response); switch (means) { case 1: Console.WriteLine("Enter Node Name:"); string nname = Console.ReadLine(); dfsmanag.addNode(nname); break; case 2: Console.WriteLine("Enter Node Name:"); string fnamer = Console.ReadLine(); dfsmanag.removeNode(fnamer);break; case 3: foreach (var item in dfsmanag.listNodes()) { Console.WriteLine(item); }break; case 4: Console.WriteLine("Shutting down server..."); dfsmanag.shutdownDFS(); break; case 5: done = true;break; default: Console.WriteLine("BadChoice"); break; } } catch (Exception e) { Console.WriteLine("Couldnt connect"); Console.WriteLine(e.ToString()); } } while (!done); }