| HelloCorba

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.

- Open up the "Server Administration" URL for your Enterprise Server:
  - insure that your webserver is on
  - and attached to Port 80.
- Web Publishing must also be enabled
  (Simply select "Web Publishing" from the main button bar, select the "On" option, and "save-and-apply changes").

- Select the HTTPD you wish to host CORBA objects on

- Select "Content Management" from the top frame, and "Additional Document Directories" from the left frame.

- Create a new URL prefix, for example, `iiop_objects`.
  This must be called "iiop_objects"

- Specify a location on your server that this URL prefix will map to.
  This is where your server will store CORBA objects, like the one HelloCorbaDaemon will create -- it must reside directly under your current primary document directory.

- Select "Server Preferences" from the top frame and "Restrict Access" from the left frame.

- Select a resource to edit using Browse and then using the options button and typing the absolute path to the location on your server you mapped `iiop_objects` to.

- Press the Edit Access Control button to edit the ACL rules for this directory.

- Make sure the "Access control is on" box is checked, and add an entry to "Allow...anyone...from anyplace...all rights..."

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

- Open Visual JavaScript (PR3 or later);
  - Create a new project
  - Add a new page.
- Create a new palette page and call it "Corba Objects"
  (see the instructions for Creating Sample Crossware from the ShowText example for more information on the basics of creating a new palette page and importing a component).

- Use the right mouse menu on the newly created "Corba Objects" tab and select "Install" and "CORBA Component".

- This will bring up a file browser; navigate to the location of the HelloCorba.idl file and select this file. This creates a HelloCorba object on the palette.

- Drag this to the blank page. Double click on the newly created HelloCorba object on the page, and set the "Object URL Address" to something like:

      http://mymachine.mydomain.com/iiop_objects/HelloCorba

  Note: If you accidentally omit this step, you will get a "corbaObject not defined" error when you press a button on the page after deployment.

- Switch to the form elements tab.

- Drag a button to the page; this creates a new form.

- Drag a text field to the same form.

- Click in the page, and hit enter after the text field.

- Add another button and another text field to the same form.

- Double click on the first button and change the "Button Label" to "Set String".

- Change the second button's label to "Get String".

- Drag the connection point from the first button to the HelloCorba object.

- Under Event Connection Source, select "new event connection".

- Under Event Connection Target, press the "View Parameters" button.

- Select an action of setOneString. Enter as the Value for value1 enter `document.Form1.Text1.value`.

- Press "Apply" then "Close" to create the connection.

- Drag the connection point from the second button to the HelloCorba object.

- Click the "View Parameters" button in the connection builder.
- Select an action of getOneString, and press the "View JavaScript" button.
- Now modify the text in the "JavaScript event handler" box from:

  > `idl_HelloCorba1.getOneString()`

  to read

  > `document.Form1.Text2.value = idl_HelloCorba1.getOneString()`

- Press "Apply" then "Close".

- Select the deploy button on your toolbar and deploy the project to your Enterprise Server
  If it is on the same machine, you can simply deploy it to a file which is located somewhere under the primary document root directory mapping for your server.

- Making sure the HelloCorba Daemon is still running, load the page in Navigator from the location where you deployed the project.
- Type "Hello Corba" in the first text field and hit "Set String."

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 )