Mapping Clients  «Prev  Next»
Lesson 9 Writing a basic client
Objective Describe the basic startup sequence of a CORBA client.

Writing a Basic Corba Client

A basic CORBA client simply needs to connect to a CORBA object and then use it. All the work in this process lies in obtaining a reference to the object after that. The remoteness of the object should be completely transparent to the client. Let us look at the basic sequence of actions performed by CORBA clients this will provide you with the basic structure that you will use when writing clients.

Client sequence

The basic steps performed by a CORBA client are:
  1. Initialize the ORB.
  2. Obtain an object reference to the desired remote object.
  3. Narrow the object reference to the type of the remote object.
  4. Use the reference to invoke methods on the remote object.
Later in the course, you will learn some of the various ways to look up and obtain object references (step 2). You will learn the details of narrowing a generic object reference to an interface-specific reference (step 4) later in this module, when we discuss helper classes.


Let us look at some code that embodies the above steps by constructing a sample client for our WeatherService server.

1) Weather Client 1 2) Weather Client 2 3) Weather Client 3 4) Weather Client 4
  1. Initialize the ORB
  2. Obtain an object reference to the remote object
  3. Narrow the generic reference to the interface-specific type reference
  4. Use the interface type reference (invoke methods)

Constructing Sample Corba Client
In the next lesson, you will learn about the stub model that is used under the hood of the client operations we just discussed.