Reusing CORBA Web Services With JavaScript

David Houlding
Below is a complete listing of the JavaScript client used to illustrate the concepts in this article.

  <SCRIPT LANGUAGE="JavaScript">
    // The manager of all CORBA requests.
    var manager;

    // One particular CORBA request. Could load more ...
    var loginRequest;

    function initialize() {
        // Set up out own error handler.
        window.onerror = handleError

        // Get handles to CORBA request manager and load requests.
        manager = document.RequestManager;
        loginRequest =
          manager.loadRequest( "SecurityServer1_login.ser","login");

    function login() {
        // Validate the input.
        var username = document.LoginForm.UsernameTextField.value;
        var password = document.LoginForm.PasswordTextField.value;
        if( ( username == "" ) || ( password == "" ) ) {
        alert( "Invalid username/password pair. Please try again." );

        // Set request input arguments.

        // Execute request.

        // Get request results.
        var secureSessionID = loginRequest.getReturnParamVal("return");

        // Show the results.
        document.cookie = "SecureSessionID=" + secureSessionID +
        // Proceed to the next page.  window.location =

    function cancel() {
        // Cancel login and proceed.
        window.location = "";

    function handleError( message, url, lineNumber ) {
        // Check for application exceptions and handle first.
        if( message == "InvalidUseridPasswordPair" ) {
        alert( "Invalid username/password pair. Please try again." );
        else {
            // System exception, problem executing request.
            alert( "An unexpected error occurred. Please restart and
                                                         try again." );
            return false;

        // Suppress the generic error alert.
        return true;
  <TITLE>CORBA Bean Manager Applet Test</TITLE>
<BODY BGCOLOR="#c0c0c0" onLoad="initialize()">

<APPLET CODE="corbabeans.DynamicRequestManagerApplet.class"
                 NAME="RequestManager" WIDTH="1" HEIGHT="1">
<PARAM NAME="useslibrary" VALUE="CORBA Beans">
<PARAM NAME="useslibrarycodebase" VALUE="">
<PARAM NAME="useslibraryversion" VALUE="2,4,0,0">

<FORM ACTION="dummy" NAME="LoginForm">
  <P ALIGN=Left>
    <TR VALIGN="Top">
      <TD><P ALIGN=Left>
	  <IMG SRC="SecurityIcon.gif" BORDER="0"></TD>
      <TD><H1 ALIGN=Left>
      <TD><P ALIGN=Left>
      <TD><P ALIGN=Left>
	  <INPUT TYPE="text" NAME="UsernameTextField"></TD>
      <TD><P ALIGN=Left>
<TD><P ALIGN=Left>
	<INPUT TYPE="password" NAME="PasswordTextField"></TD>
      <TD><P ALIGN=Left>
    <INPUT TYPE=button VALUE="Login" onClick="login()">
	<INPUT TYPE=button VALUE="Cancel" onClick="cancel()">
  <P ALIGN=Left>