FileDocCategorySizeDatePackage
DIISimpleClient2.javaAPI DocExample1529Wed Apr 05 11:25:42 BST 2000None

DIIClient

public class DIIClient extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] argv)

    org.omg.CORBA.ORB myORB = org.omg.CORBA.ORB.init(argv, null);
    org.omg.CORBA.ORB singleORB = org.omg.CORBA.ORB.init();
    try {
      org.omg.CORBA.Object ncRef = 
	myORB.resolve_initial_references("NameService");
      NamingContext nc = NamingContextHelper.narrow(ncRef);

      NameComponent nComp = new NameComponent("Server", "");
      NameComponent[] path = {nComp};
      org.omg.CORBA.Object objRef = nc.resolve(path);

      // Make a dynamic call to the doThis method

      // First build the argument list.  In this case, there's a single String
      // argument to the method.
      Request thisReq = objRef._request("doThis");
      Any arg1 = thisReq.add_in_arg();
      arg1.insert_string("something");

      // Invoke the method...
      thisReq.invoke();
      Any result = thisReq.return_value();
      System.out.println("doThis() returned: " + result.extract_string());
    }
    catch (Exception e) {
      e.printStackTrace();
    }