What happens if the Java interfaces for
the remote CORBA Object servers are not available at compile time?
You might get a reference to a CORBA Object from a Naming Service,
and not know what interface that object implements. Both the
Dynamic Invocation Interface (DII) and the Dynamic Skeleton
Interface (DSI) API in CORBA provide "A Dynamic Interface to
a CORBA Object whose interface is not known at compile time to
the client of the CORBA Object".

The Steps involved in developing
a CORBA Client that invokes a CORBA Server dynamically using the
Dynamic Invocation Interface are:

public class DIIStockMarketClient
{public
static void main (String[] args) {ORB
myORB = ORB.init (args, null);
ORB singleORB = ORB.init (); try {//
Get a reference to the objectorg.omg.CORBA.Object
ncRef = myORB.resolve_initial_references ("NameService");
NamingContext nc = NamingContextHelper.narrow (ncRef);
NameComponent nComp = new NameComponent ("NASDAQ",
"");
NameComponent [] path = {nComp};
org.omg.CORBA.Object objRef = nc.resolve (path);//
Now make a dynamic call to the get_price method.
The first step is // to build
the argument list. In this case, there's a single String // argument
to the method, so create an NVList of length 1.
Next // create an
Any object to hold the value of the argument and insert // the
desired value. Finally, wrap the Any object with a
NamedValue // and insert
it into the NVList, specifying that it is an input // parameter.
NVList argList = myORB.create_list (1);
Any argument = myORB.create_any ();
argument.insert_string ("MY_COMPANY");
NamedValue nvArg = argList.add_value ("symbol",
argument, org.omg.CORBA.ARG_IN.value);//
Create an Any object to hold the return value of the
method and // wrap it in
a NamedValue
Any result = myORB.create_any ();
result.insert_float (0);
NamedValue resultVal = myORB.create_named_value ("result",
result, org.omg.CORBA.ARG_OUT.value);