import HelloApp.*; |
import org.omg.CosNaming.*; |
import org.omg.CORBA.*; |
public class HelloClient { |
public static void main(String args[]) { |
try{ // create and initialize the ORB |
ORB orb = ORB.init(args, null); |
// get the root naming context |
org.omg.CORBA.Object objRef = |
orb.resolve_initial_references("NameService"); |
NamingContext ncRef = NamingContextHelper.narrow(objRef); |
// resolve the Object Reference in Naming |
NameComponent nc = new NameComponent("Hello", ""); |
NameComponent path[] = {nc}; |
Hello HelloRef = HelloHelper.narrow(ncRef.resolve(path)); |
// call the Hello server object and print results |
String Hello = HelloRef.sayHello(); |
System.out.println(Hello); |
} . . . // catch exceptions |
} |