Creating the CORBA server main code (server.cpp)

Why and when to perform this task

Use this task to create a CORBA server that hosts a servant object. The server performs the following tasks:

  1. Validates user input
  2. Initializes the server environment
  3. Accesses naming contexts
  4. Names, creates, and binds a servant object
  5. Creates a server shutdown object
  6. Goes into a wait loop
  7. Services requests

This task is the next step after adding code for the business logic methods in the servant implementation file, servant_I.cpp. For more information about adding code to a servant implementation file, see Adding code to a CORBA servant implementation (servant_I.cpp).

Steps for this task

  1. Create a source file, servantServer.cpp, where servant is the name of the implementation class for which the server is to service requests.
  2. Edit the server source file, servantServer.cpp, to add appropriate code to implement the server methods. To do this, complete the following steps:
    1. Add the necessary include statements, as described in Adding include statements.
    2. Add the main() function, in the form:
      int main( int argc, char *argv[] )
       {
         int rc = 0;
       }
       
  3. Edit the server source file, servantServer.cpp, to add appropriate code to initialize the server environment as described in Adding code to initialize the server environment.
  4. Edit the server source file, servantServer.cpp, to add appropriate code to access naming contexts as described in Adding code to access naming contexts.
    At this point, initialization has been accomplished and a naming context has been created for servant objects.
  5. Edit the server source file, servantServer.cpp, to add appropriate code to create and bind servant objects as described in Adding code to create and bind servant objects.
  6. Edit the server source file, servantServer.cpp, to add code to create a server shutdown object as described in Adding code to create a server shutdown object.
  7. Edit the server source file, servantServer.cpp, to add code to put the server into an infinite loop (to service any ORB requests received) as described in Adding code to put the server into an infinite loop.
  8. Edit the server source file, servantServer.cpp, to add code to shutdown the server and release resources used as described in Adding code to shutdown the server and release resources used.

Related tasks
Developing a CORBA C++ server
Completing the CORBA servant implementation (servant_I.cpp)



Searchable topic ID:   tcor_pgms5
Last updated: Jun 21, 2007 8:07:48 PM CDT    WebSphere Business Integration Server Foundation, Version 5.0.2
http://publib.boulder.ibm.com/infocenter/wasinfo/index.jsp?topic=/com.ibm.wasee.doc/info/ee/corba/tasks/tcor_pgms5.html

Library | Support | Terms of Use | Feedback