WebLogic Server 6.1.0a1 Code Examples, BEA Systems, Inc.

Package examples.rmi_iiop.hello C++ client

The files in this package are used to create a C++ CORBA client that accesses the remote object created in the Hello example.

See:
          Description

Class Summary
HelloClient This CORBA client initializes an ORB, obtains a reference to the HelloServer, and calls HelloServer methods.
 

Package rmi_iiop.hello C++ client Description

The files in this package are used to create a C++ CORBA client that accesses the remote object created in the Hello example. The client was created to use VisiBroker for C++, version 4.0. The following instructions assume you have installed VisiBroker for C++ and Microsoft Visual C++.

The following section describes how to build and run the examples:

  1. Build the example
  2. Run the example

Build the example

  1. This example uses the RMI remote object created in the Hello example. You must first build and deploy the Hello example.

  2. Set up your development shell as described in Setting up your environment.

  3. Note: Edit the variable VISIBROKER_HOME and MSVC_HOME in the build_c++_client file provided for this example in the samples/examples/rmi_iiop/hello directory for your VisiBroker for C++ and Microsoft Visual C++ installation.

  4. Execute the build_c++_client script provided for this example in the samples/examples/rmi_iiop/hello directory as shown in this example for Windows NT/2000:

    $ build_c++_client

    The preceding script will perform the following steps:

    1. Set the PATH as shown in this example for Windows NT:

      $ set PATH=%PATH%;%WL_HOME%\lib;%VISIBROKER_HOME%\bin;%VISIBROKER_HOME%\lib;%MSVC_HOME%\bin
      where:
      WL_HOME
      WebLogic Server installation directory
      VISIBROKER_HOME
      VisiBroker installation directory
      MSVC_HOME
      Microsoft Visual C++ installation directory

    2. Compile the HelloWorld.idl file located in the samples\examples\rmi_iiop\hello\idlSources\examples\rmi_iiop\hello directory with the VisiBroker idl2cpp utility as shown in this example for Windows NT:

      $ idl2cpp -I%WL_HOME%\lib -IidlSources -src_suffix cpp idlSources\examples\rmi_iiop\hello\HelloWorld.idl
      where WL_HOME is the WebLogic Server installation directory.

    3. Compile the Remote.idl file located in the samples\examples\rmi_iiop\hello\idlSources\java\rmi directory with the VisiBroker idl2cpp utility as shown in this example for Windows NT:

      $ idl2cpp -I%WL_HOME%\lib -IidlSources -src_suffix cpp idlSources\java\rmi\Remote.idl

    4. Create a java and java\rmi directory under rmi_iiop\hello\cpp directory and copy the Remote*.* files generated in the previous step to the java\rmi directory.

      $ mkdir java java\rmi

      $ copy Rem*.* cpp\java\rmi

      $ copy HelloWorld_* cpp

      $ cd cpp

    5. Compile the HelloClient.cpp and HelloWorld_c.cpp file located in the samples\examples\rmi_iiop\hello\cpp directory and create the executable HelloClient.exe file as shown in this examples for Windows NT:

      $ CL -DWIN32 /GX /MD -I%VISIBROKER_HOME%\include 
                  -I%MSVC_HOME%\include /Z7 -DVISIBROKER HelloClient.cpp HelloWorld_c.cpp /link /libpath:%VISIBROKER_HOME%\lib /out:HelloClient.exe
      where:
      VISIBROKER_HOME
      VisiBroker installation directory
      MSVC_HOME
      Microsoft Visual C++ installation directory

Run the example

  1. Start the WebLogic Server in a command shell.

  2. In a new command shell, set up your development shell as described in Setting up your environment.

  3. Obtain the WebLogic Server Inter-operable Object Reference (IOR) by running the host2ior utility as shown in this example for Windows NT:
      $ java utils.host2ior hostname port
    where:
    hostname
    Host name of the WebLogic Server
    port
    Port where the WebLogic Server is listening for connections (weblogic.system.ListenPort).
    The WebLogic Server IOR will be returned to the console. Select and copy the IOR to the clipboard. The console may insert line breaks into the IOR where it wraps to the next line. You must remove the linebreaks before pasting the IOR into the command-line argument list of an RMI over IIOP example. You can remove the line breaks by pasting into the IOR into an text editor, deleting the linebreaks, then re-copying the IOR to the clipboard.

  4. In the Client shell, run HelloClient.exe with the following command:
      $ HelloClient ServerIOR
    where ServerIOR is the IOR you obtained by running the host2ior utility.

There's more...

Read more about:


Documentation is available at
http://www.weblogic.com/docs61

Copyright © 2000 BEA Systems, Inc. All rights reserved.