    All Examples RMI over IIOP Examples Hello Example

# examples.rmi_iiop.hello C++ client

## hello example C++ client

# about this example

The files in this directory 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 3.3.3. The instructions below assume you have installed VisiBroker for C++ and Microsoft Visual C++.

# how to use this 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. In the Hello example, a HelloWorld.idl file was created in the /weblogic/examples/rmi_iiop/hello/idlSource/examples/rmi_iiop/hello directory. Compile the HelloWorld.idl file with the VisiBroker idl2cpp utility as shown in this example for Windows NT:

         $ idl2cpp -IVisiBrokerHome\idl -I..\idlSource -src_suffix cpp
             ..\idlSource\examples\rmi_iiop\hello\HelloWorld.idl

   where VisiBrokerHome is the VisiBroker installation directory.
3. In the Hello example, a Remote.idl file was created in the /weblogic/examples/rmi_iiop/hello/idlSource/java/rmi directory. Compile the Remote.idl file with the VisiBroker idl2cpp utility as shown in this example for Windows NT:

         $ idl2cpp -IVisiBrokerHome\idl -src_suffix cpp ..\idlSource\java\rmi\Remote.idl

4. Under this directory, create a java/rmi directory and copy the Remote*.* files generated in the previous step to the new directory.
5. The previous steps generate additional cpp files into the current directory. Compile the generated files as shown in this examples for Windows NT:

         $ CL -DWIN32 /GX /MT -IVisiBrokerHome\include
                   -IVisualCHome\include /Z7 -DVISIBROKER -c HelloClient.cpp HelloWorld_c.cpp

   where:
   VisiBrokerHome
     VisiBroker installation directory
   VisualCHome
     Microsoft Visual C++ installation directory
6. Link the HelloClient.exe as shown in this example for Windows NT:

         $ LINK /nologo /DEBUG /out:HelloClient.exe /LIBPATH:VisualCHome\lib HelloWorld_c.obj HelloClient.obj
                   VisiBrokerHome/lib/name_r.lib VisiBrokerHome/lib/orb_r.lib

   where:
   VisiBrokerHome
     VisiBroker installation directory
   VisualCHome
     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 environment 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 command 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 WebLogic RMI over IIOP in the Developer Guide, Using WebLogic RMI over IIOP.

Read more about WebLogic RMI in the Developer Guide, Using WebLogic RMI.

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

Last updated 1/13/2000