[Enterprise Extensions only]
  Next topic

C++ CORBA client, locating the root naming context (bootstrapping)

The naming service can be used to manage a directory of objects, to map the name of each object to its associated object reference. To locate a server object somewhere in a CORBA environment, a client can locate the naming service, then use a name to retrieve an associated object reference from the naming service.

The location of the naming server that provides the naming service, and the number of the port that it uses to communicate with clients and servers, are specified by enterprise services' runtime properties. The values that you specify for the runtime properties must match the equivalent settings used to configure WebSphere Application Server.

Object references are bound into the naming service relative to the root naming context.

When a client is started, it uses a "bootstrapping" operation to locate the naming service then locate the root naming context, as follows:

  1. The client calls the ORB::resolve_initial_references("NameService") method, which returns a CORBA::Object.
  2. Before the client can use the returned reference as a naming context, the client must narrow the object to the desired class.

For example:

objPtr = op->resolve_initial_references( "NameService" ); 
rootNameContext = ::CosNaming::NamingContext::_narrow(objPtr); 

The resolve_initial_references( "NameService" ) method is implemented according to a pre-INS specification. It does work with earlier versions of some 3rd-party ORBs, but not with ORBs that implement the current INS specification.

If the client bootstrapping operation does not establish contact with a remote naming service, you can use alternative strategies to retrieve the IOR of the naming service, as outlined in Strategies for retrieving the IOR of a remote object.

Strategies for retrieving the IOR of a remote object

If the client bootstrapping operation does not establish contact with a remote naming service, you can use the following alternative strategies to retrieve the IOR of a remote object:

  Next topic