Back Forward CDK Home Reference Samples Resources
HelloCorba

 Building the HelloCorba Component

The HelloCorba component consists of one IDL file -- a web designer using a tool like Visual JavaScript would only need to import this one file to build web applications that utilize the CORBA services. The CORBA services are handled on the server by the HelloCorba daemon, a small Java file which extends Java classes automatically generated from HelloCorba.idl. These classes are generated by idl2java; a utility which is included in Netscape Enterprise Server 3.0.


The contents of the idl subdirectory are automatically generated using a batch file, which also compiles all the classes in the idl subdirectory and the main HelloCorba directory: Note: Before you run BuildHelloCorba, you may need to modify it to point to appropriate directories on your machine. Also note that it requires Java 1.1.2 or better.

BuildHelloCorba first calls Java with a classpath set to include nisb.zip from your Enterprise Server 3.0 installation, as well as iiop10.jar from your Communicator installation. "nisb.zip" contains the Java utility program com.visigenic.vbroker.tools.idl2java. The idl directory could be empty at first, and running idl2java will populate it with the Java classes needed to support HelloCorba.idl.

The automatically generated files include:

Once these files are created, BuildHelloCorba runs Javac on the files within the package idl and our main file, HelloCorbaDameon.java with a classpath that includes iiop10.jar from your Communicator installation.

Note: Additional CORBA Sample Code can be found on Netscape's Developer site

 Creating Sample Crossware

Once you have run BuildHelloCorba and created all the necessary classes, you will want to make sure your Enterprise Server is set up with a directory (for example, one called iiop_objects) for CORBA objects with read/write permissions granted to all.

Note: Setting up such a CORBA repository directory with read/write permissions granted to All will pose a security risk, and is not a recommended technique for use outside of a firewall.

Setting Up the iiop_objects Directory

The following assumes a familiarity with Enterprise Server 3.x or better.



Now save and apply your changes.

Running the HelloCorbaDaemon

Note: Before you run RunHelloCorbaDaemon, you may need to modify it to point to appropriate directories on your machine.

Running the script RunHelloCorbaDaemon.bat (type sh RunHelloCorbaDaemon.sh on Unix) will run the HelloCorbaDaemon object in a Java session with the ORB Locator disabled. This should produce output similar to:

HelloCorba: initializing...
HelloCorba: starting CORBA...
HelloCorba being registered to: http://jenni/iiop_objects/HelloCorba
HelloCorba Daemon ready for service

If you look in the iiop_objects directory on your server, you should now see a HelloCorba file. This contains the data for the Corba object which is being managed by the HelloCorbaDaemon.

Using the HelloCorba Crossware Component in Visual JavaScript






Now, when you press "Get String" it will retrieve the string from the CORBA object -- even if you go to another machine and load the page there, pressing "Get String" will retrieve the same string!

Congratulations! You have just built your first CORBA Crossware Application!!


( return to the top of the page )