// Get the stringified reference from our command-line arguments
String sor = null;
if (argv.length > 0) {
sor = argv[0];
}
else {
System.out.println("You forgot the object reference...");
System.exit(1);
}
try {
// Obtain ORB reference
ORB myORB = ORB.init(argv, null);
// Convert the stringified reference into a live object reference
org.omg.CORBA.Object objRef = myORB.string_to_object(sor);
// Narrow the object reference to a ThisOrThatServer
// using the ThisOrThatServerHelper
ThisOrThatServer server = ThisOrThatServerHelper.narrow(objRef);
// Invoke some methods on the remote object through the stub
server.doThis("something");
server.doThat("something else");
}
catch (Exception e) {
System.out.println("An error occurred while initializing server object:");
e.printStackTrace();
}