Articles     Forum     Examples     Download     Open Source

 

PocoCapsule/C++ example: CORBA Hello

Copyright(c) 2006 by Pocomatic Software. All rights reserved.

This example illustrates a basic CORBA client/server application deployed in PocoCapsule/C++ IoC Container.

Source Files

Greeting.idl: This is the IDL definition of the server's remote interface.

server.C: This is a simple container, used to deploy the server corba application context.

client.C: This is the client application.

GreetingImpl.h and GreetingImpl.C: The server's application logic bean implementation (e.g. servant implementation), namely, a class inherited from the POA_sample::Greeting abstract class.

setup.xml: This is the server's deployment descriptor. It describes the following server structure:

Building this example

To build this example, the environment variable POCOCAPSULE_DIR should point to the PocoCapsule/C++ installed directory. Also, this example assumes an underneath ORB (e.g. VisiBroker/C++, TAO, etc.) is installed and its runtime and development environment (such as POCOCAPSULE_DIR, VBROKER_DIR or TAO_ROOT, etc. env variable) are set according to its product specification. Then, this example can be built by simply invoking gmake/make on linux/unix or nmake on windows.

Running this example

· Before starting the server, make sure the LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows) environment variable is set correctly to include the ${POCOCAPSULE_DIR}/lib directory and the ${VBROKREDIR}/lib (if VisiBroker is used) or the ${TAO_ROOT}/lib directory (if TAO is used).

· Start the server:

prompt> server 

By default setting, on successful startup, server will print out all declared corbaloc URLs (namely, <object> elements, with specified uri attribute). In this server, as the object element is declared with uri attribute equals to “my-server”, the print out will be, for instance:

Server is ready, with URL:
corbaloc::192.168.2.3:2809/my-server

Here, the URI value “my-server” is declared in the server's deployment descriptor setup.xml file.

· Start client: The server's corbaloc URL should be used as the first main command line argument when starting the client. For instance:

prompt> client corbaloc::192.168.2.3:2809/my-server

On success, client sends a greeting message to server, and server replies one back to client. Both sides will print out the greeting message they received.

Back to the root page