You are on page 1of 2

Corba Steps

 Idl file
1. interface myinf
{
Attribute aname;
Void method1();
Datatype method2(in para1);
};

 Idlj –fall –oldImplBase file.idl

 Server Object
1. class serverobject extends _myinfImplBase
{
Method1();
Method2();
}
 Server
1. import org.omg.CORBA.*;
2. import org.omg.CosNaming.*;
3. class Server
{
Public static void main(String args[])
{
ORB orb = ORB.init(args,null);

Org.omg.CORBA.Obejct contextObj =
orb.resolve_initial_references(“NameService”);

NamingContext rootContext =
NamingContextHelper.narrow(contextObject);

ServerObj s = new ServerObj();

NameComponent name = new NameComponent(“Name”,””);


NameComponent path[]={name};

rootContext.rebind(path,s);

java.lang.Object obj = new java.lang.Object();


synchronized(obj){ obj.wait(); }
}
}
 Client
1. import org.omg.CORBA.*;
2. import org.omg.CosNaming.*;
3. class Client
{
Public static void main(String args[])
{
ORB orb = ORB.init(args,null);
Org.omg.CORBA.Object contextObj =
orb.resolve_initial_references(“NameService”);

NamingContext rootContext =
NamingContextHelper.narrow(contextObj);

NameComponent name = new NameComponent(“name”,””);


NameCompnent path[]= {name};

Org.omg.CORBA.Object obj = rootContext.resolve(path);

Myinf mobj = (myinf)myinfHelper.narrow(obj);

Mobj.method1();
Mobj.method2();

Mobj._release();
}
}

 Steps to be followed
1. tnameserv –ORBInitialPort <portno>
2. java server
3. java client

You might also like