Coding the client with the Static Invocation Interface - SII
 

Client.java
 

// Building Distributed Object Applications with CORBA 
// Infowave (Thailand) Co., Ltd. 
// http://www.waveman.com 
// Jan 1998 

public class Client { 
   public static void main(String[] args) { 
      if(args.length != 2) {
         System.out.println("Usage: vbj Client <carrier-name> <aircraft-name>\n");
         return;
      }

      String carrierName = args[0];
      String aircraftName = args[1];

      org.omg.CORBA.ORB orb = null; 
      try { 
          orb = org.omg.CORBA.ORB.init(args, null); 
      } 
      catch (org.omg.CORBA.SystemException se) { 
         System.err.println("ORB init failure " + se); 
         System.exit(1); 
      } 

      org.omg.CORBA.BindOptions bindOptions = new org.omg.CORBA.BindOptions(); 
      bindOptions.defer_bind = false; 
      bindOptions.enable_rebind = true; 

      // Third parameter in bind can be IP Address like 127.0.0.1 
      // or Hostname like www.waveman.com 

      Ship.AircraftCarrier carrier = null; 
      try { 
         carrier = Ship.AircraftCarrierHelper.bind(orb, carrierName, "127.0.0.1", bindOptions); 
      } 
      catch (org.omg.CORBA.SystemException se) { 
         System.err.println("ORB bind failure " + se); 
         System.exit(1); 
      } 

      Ship.Aircraft aircraft = null; 
      try { 
         aircraft = carrier.launch(aircraftName); 
      } 
      catch (org.omg.CORBA.SystemException se) { 
         System.err.println("Carrier launch failure " + se); 
         System.exit(1); 
      } 

      String designation = aircraft.codeNumber(); 

      System.out.println("Aircraft " + designation + " is airborne"); 

      org.omg.CORBA.IntHolder alt = new org.omg.CORBA.IntHolder(10000); 

      try { 
         aircraft.attitude(alt, "headup"); 
         System.out.println(designation + " going up to " + alt.value + " Ft."); 
      } 
      catch (org.omg.CORBA.SystemException se) { 
         System.err.println("Aircraft instruction failure " + se); 
         System.exit(1); 
      } 

      try { 
         aircraft.attitude(alt, "headdown"); 
         System.out.println(designation + " going down to " + alt.value + " Ft."); 
      } 
      catch (org.omg.CORBA.SystemException se) { 
         System.err.println("Aircraft instruction failure " + se); 
         System.exit(1); 
      } 
   } 
}
 


Building the client:

Create a directory and place Ship.idl and Client.java into it.
 


prompt> idl2java Ship.idl
prompt> vbjc Client.java