Listing 5: Browser data request

import Data.*;               // The package containing the stubs.
import org.omg.CosNaming.*;  // Client will use the naming service.
import org.omg.CORBA.*;      // All CORBA applications need these 
                             // classes.

...

// Create and initialize the ORB
ORB orb = ORB.init(mIPAddress, 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 service and obtain 
// DataInfo reference
NameComponent[] path = 
   { new NameComponent(“DataReader”, “Context”),
                       new NameComponent(“Data”, “Object”) };
DataInfo dataRef = DataInfoHelper.narrow(ncRef.resolve(path));

// Create Holder (container) for returning data byte stream
Data.UnboundedDataHolder sa = new Data.UnboundedDataHolder();

// Call the server object and obtain the data
int val = dataRef.getData(fileName, resolution, mLoadFileAs, sa);

...
— End of Listing —