|
RMI-IIOPHello IDL SampleCopyright © 1999 Sun Microsystems, Inc.
|
This sample illustrates how an RMI-IIOP program can inter-operate with a conventional IDL program. It assumes that you have already built and run the RMI-IIOP "Hello World" sample program. This sample shows inter-operability with IDL programs built in Java but of course any programming language which supports IDL could be used.
When you have built the two sets of clients and servers you will be able to run them in the following combinations:
Client | Server |
RMI-IIOP | RMI-IIOP |
IDL | IDL |
RMI-IIOP | IDL |
IDL | RMI-IIOP |
The sample IDL source code is found in the $JAVA_HOME/demo/rmi-iiop/idl directory. There you will find the following files:
To provide a complete explanation in the steps that follow, we make the following assumptions:
Set your CLASSPATH environment variable so that the current directory (".") is at the beginning.
Check that your PATH environment variable includes $JAVA_HOME/bin:$JAVA_HOME/jre/bin, where $JAVA_HOME is the directory where the Java SDK is installed.
After configuring your environment, as explained above, change directory to $DEMO_HOME/idl.
cp $JAVA_HOME/demo/rmi-iiop/idl/*.java .
rmic -idl -d idl hello.RemoteHelloServer
cd idl
idlj -Fclient hello/RemoteHello.idl
javac -d . RemoteHelloApplication.java javac -d . RemoteHelloApplet.java
Note:
The next two steps are not required if you only require an IDL client.
idlj -Fall hello/RemoteHello.idl
javac -d . RemoteHelloServer.java
For the client IDL application you must copy the following files to a hello sub-directory on your client system.
Copy the following .class files to your server directory (e.g. $SERVER_ROOT/java/hello using our sample naming conventions).
The idl.html file should be copied to $SERVER_ROOT.
Run the name server that will be used to resolve the name RemoteHelloServer that will be used by your applicaton. The name server you run is the same whether you are running an RMI-IIOP program or an IDL one.
tnameserv
Run the IDL server application, passing parameters to the system with the -D option. Note that there must be no space between the -D and the property text that follows it.
java -Dorg.omg.CORBA.ORBInitialHost=aslan.narnia.com hello.RemoteHelloServer
Run the application, passing the host address and port number of the server to the application as system properties.
java -Dorg.omg.CORBA.ORBInitialHost=aslan.narnia.com hello.RemoteHelloApplication
Run the applet using appletviewer.
appletviewer http://aslan.narnia.com/idl.html
It is simplest to test the applet using the appletviewer in this way. To use a browser such as Internet Explorer or Netscape Navigator you will need to modify idl.html or iiop.html to enable the browser to use the Java plug-in. Details of the Java plug-in can be found on the following website: http://java.sun.com/products/ plugin
You now have a running IDL client and (optionally) an IDL server application. If you have previously implemented the RMI-IIOP "Hello World" sample you will also have a running RMI-IIOP client and server. You are now ready to inter-operate between heterogeneous clients and servers.