Basic HTML version of Foils prepared 4 Feb 98

Foil 56 Example Client - Hello

From Overview of JDBC and its use with CORBA or Java RMI CPS616 Technologies of Information Age -- Spring 1998. by Nancy McCracken(Sangetta Aggarwal, Udayan Parvate, Tom Pulikal)


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 = orb.resolve_initial_references("NameService");
10 NamingContext ncRef = NamingContextHelper.narrow(objRef);
11 // resolve the Object Reference in Naming
12 NameComponent nc = new NameComponent("Hello", "");
13 NameComponent path[] = {nc};
14 Hello HelloRef = HelloHelper.narrow(ncRef.resolve(path));
15 // call the Hello server object and print results
16 String Hello = HelloRef.sayHello();
17 System.out.println(Hello);
18 } catch (Exception e) {
19 System.out.println("ERROR : " + e) ;
20 e.printStackTrace(System.out);
21 }}}

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 Sun Nov 29 1998