[Enterprise Extensions only]

The CORBA server programming model

This topic describes the CORBA server programming model, which describes the interfaces and processes used to develop CORBA server objects that make up the business logic and business data inherent in a server application. Application programmers use the server programming model if they are developing CORBA server implementation objects, known as servant objects, that perform business functions used in the implementation of client objects.

The concepts about the server programming model are derived from the following general procedure for developing a CORBA server. The steps link to more detailed concepts. For task information about developing a CORBA server, see Developing a CORBA server.

Examples of server programming are given in the WSLoggerServer sample, for which files are included with WebSphere in the following directory: WAS_HOME/Enterprise/samples/sampcppsdk.

  1. Specifying the business logic implementation interface for the servant (servant.idl).

    In an IDL (interface definition language) file, you define the public interface to the methods provided by the business logic. This defines the information that a client must know to call and use a servant object. For more information about the IDL definition of an implementation, see Interface Definition Language (IDL), usage and implementation.

  2. Compiling the servant IDL (using idlc).

    Compiling the servant IDL file produces the usage binding files to implement and use the servant object within a particular programming language. For example, this creates an implementation template that provides a native, server language class template into which method behavior can be inserted. WebSphere supports CORBA servers implemented in C++.

  3. Adding declarations for class variables, constructors, and destructors to the servant class definition (servant.ih).

    The implementation class interface header (servant.ih) created by idlc contains a skeleton class definition, but lacks declarations for class variables, constructors, and destructors. You need to add the missing declarations.

  4. Completing the servant implementation (servant_I.cpp).

    The implementation class (servant_I.cpp) created by idlc contains a skeleton implementation definition, which you need to complete by adding the business logic that the servant is to provide.

  5. Creating the server main code (server.cpp). You need to create the server code, to define the methods that the server implements. In particular, you need to create the main method, which controls the server runtime by performing the following tasks:
    1. Validating user input
    2. Initializing the server environment
    3. Accessing naming contexts
    4. Creating a servant object
    5. Binding the servant object to the appropriate naming context
    6. Creating a server shutdown object
    7. Going into a wait loop
    8. Servicing requests
  6. Building the server object and server code. Like anyother programming model, you need to build the modules that the server host can use to run the server and the servant.
  7. Storing a logical definition for the server in the system implementation repository (using regimpl).

    Each server needs a unique logical definition in the implementation repository of the host on which the server is to run. The logical definition defines the server alias that is used to control the server.