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.
The basic steps performed by a CORBA client are:
- Initialize the ORB.
- Obtain an object reference to the desired remote object.
- Narrow the object reference to the type of the remote object.
- 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.