/** ** ** MinCor-C# -Demo ** CORBA Solution for .Net with C# Language mapping ** Version: 1.0 ** ** Copyright: ** Middsol GmbH, Hamburg ** Germany 2004 ** www.Middsol.com ** info@Middsol.de ** */ using System; using System.Drawing; using System.Collections; using System.Windows.Forms; using System.Data; namespace DotNetClient { public class ClientImpl { private static string[] m_strORBInit = {"-ORBDebug", "-ORBInitRef NameService=corbaloc:iiop:1.2@localhost:10050/NameService", "-AddAssembly DotNetClient.exe, JavaBuiltinTypesCF.dll, MinCorCF.dll" }; public static void runDemo( FrmClt a_oFrmClt, string a_strIpAddr) { ObjectByValue.Greetings oGreetings; Middsol.CORBA.ORB oOrb = null; m_strORBInit[1] = m_strORBInit[1].Replace("localhost", a_strIpAddr); try { oOrb = Middsol.CORBA._ORB.init( m_strORBInit, null); Middsol.CosNaming.NamingContextExt oNsCtx = Middsol.CosNaming.NamingContextExtHelper.narrow( oOrb.resolve_initial_references("NameService")); try { oGreetings = ObjectByValue.GreetingsHelper.narrow( oNsCtx.resolve_str("OBVJavaServer")); } catch(Middsol.CosNaming.NamingContextPackage.NotFound ex) { a_oFrmClt.writeLog( "NS Manager Error:" + ex.why); throw new System.Exception(); } ObjectByValue.InfoImpl oInfoPram = new ObjectByValue.InfoImpl(); oInfoPram.name = "DotNet"; oInfoPram.message = "A message from your .NET Client."; ObjectByValue.Info oInfoRet = oGreetings.hello( oInfoPram);//??? a_oFrmClt.writeLog("Call Greetings.hello(...)"); a_oFrmClt.writeLog(" Returns"); a_oFrmClt.writeLog("InfoRet.name :" + oInfoRet.name); a_oFrmClt.writeLog("InfoRet.message:" + oInfoRet.message); } catch( Middsol.CORBA.SystemException exSys) { a_oFrmClt.writeLog( "Catch Exception from Server (Middsol.CORBA.SystemException)."); a_oFrmClt.writeLog( "ID:" + exSys.ID); } finally { if( oOrb != null) oOrb.destroy(); } } } }