![]() |
|
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:
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:
You can obtain the remote ORB's root name context and stringify it into a file. During ORB initialization, CORBA clients and servers can set the ORB property com.ibm.CORBA.InitialReferencesURL to the URL of the file that contains the stringified IOR of a root naming context. The root naming context is then returned by calling resolve_initial_references("NameService").
You can write an application to store the stringified IOR of a remote ORB's root naming context into a file. You can then make the file available (for example, by copying) to the client environment. The client can then read the stringified IOR from the supplied file and use the ORB::string_to_object interface to resolve the root naming context. This approach needs to be used only once during initialization, even if the client is to access many different server objects registered with the same naming service. In addition, the IOR for the name server is typically fairly static, so it is relatively simple to manage in a distributed environment.
The client can look up an entry in the name server of one ORB, then rebind the reference in the name server of a different ORB. For example, you can write a utility to look-up an EJB's home in the WebSphere name service, stringify the object reference and write it to a file. You can then use another utility to read this file, destringify the object reference and bind it into a 3rd-party ORB's naming service.
A client can make use of a coexistent 3rd-party ORB that supports bootstrapping with other ORBs from the same vendor.
![]() |