Basic HTML version of Foils prepared May 19 1999

Foil 76 Example Client - Hello

From CORBA Common Object Request Broker Architecture Basic Information Track Computational Science Course CPS616 -- Spring Semester 1999. by Geoffrey Fox, Wojtek Furmanski, Nancy McCracken, Chao-Wei Ou, Shrideep Pallickara


1 import HelloApp.*;
2 import org.omg.CosNaming.*;
3 import org.omg.CORBA.*;
4 public class HelloClient {
5 public static void main(String args[]) {
6 try{ // create and initialize the ORB
7 ORB orb = ORB.init(args, null);
8 // get the root naming context
9 org.omg.CORBA.Object objRef =
10 orb.resolve_initial_references("NameService");
11 NamingContext ncRef = NamingContextHelper.narrow(objRef);
12 // resolve the Object Reference in Naming
13 NameComponent nc = new NameComponent("Hello", "");
14 NameComponent path[] = {nc};
15 Hello HelloRef = HelloHelper.narrow(ncRef.resolve(path));
16 // call the Hello server object and print results
17 String Hello = HelloRef.sayHello();
18 System.out.println(Hello);
19 } . . . // catch exceptions
20 }

in Table To:


© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Mon Jul 5 1999