Servant object access

To be able to locate a servant object somewhere in a CORBA environment, a client must know the object reference that uniquely identifies the target object.

When an object is created, it is assigned an object reference, which can be bound with a name in the naming service. Any client (or any other object) with access to the naming service can use the associated name to retrieve the object reference.

Object references are bound into the naming service relative to the root naming context. After a client has located the root naming context, it can use the standard CosNaming interface to navigate the name space and retrieve the object reference associated with any name as shown in the following example:

// Create a new ::CosNaming::Name to pass to resolve(). 
// Construct it as the full three-part complex name. 
::CosNaming::Name loggerName; 
loggerName.length( 3 ); 
loggerName[0].id = ::CORBA::string_dup( "persistent" ); 
loggerName[0].kind = ::CORBA::string_dup(""); 
loggerName[1].id = ::CORBA::string_dup( "WSLoggerContext" ); 
loggerName[1].kind = ::CORBA::string_dup( "" ); 
loggerName[2].id = ::CORBA::string_dup( "WSLoggerObject1" ); 
loggerName[2].kind = ::CORBA::string_dup( "" ); 
::CORBA::Object_ptr objPtr = rootNameContext->resolve( loggerName ); 
liptr = WSLogger::_narrow( objPtr);

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


Related concepts
Strategies for retrieving the IOR of a remote object
Related tasks
Accessing the servant object



Searchable topic ID:   ccor_ipgmc3
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/concepts/ccor_ipgmc3.html

Library | Support | Terms of Use | Feedback