Overview | Obtains an object reference to a key service, such as the Naming Service or the Interface Repository. |
Original class | CORBA::ORB |
Exceptions | If the input identifier is not valid, a CORBA::ORB::InvalidName exception is thrown. |
If another error occurs, a CORBA::SystemException is thrown. |
Intended Usage
The CORBA::ORB::resolve_initial_references method is intended to be used by client and server applications to obtain initial object references for accessing key services, such as the Interface Repository, Naming Service or other services registered with the ORB.
The caller specifies the identifier of the service for which a reference is needed, then narrows the return result to the proper type. For example, when the input is "InterfaceRepository", the return result should be narrowed to CORBA::Repository. References to services registered with the orb by the CORBA::ORB::register_initial_reference method can be obtained using their identifier. References of Current interfaces can also be obtained by invoking ORB::resolve_initial_references with their identifier.
When the input identifier is "NameService", the return result is the root name context of the naming tree, and should be narrowed to CosNaming::NamingContext (or some class derived from it). Typically an application uses CORBA::ORB::resolve_initial_references to obtain a reference to the root name context, then invokes operations on that reference to obtain all other object references.
To configure the behavior of resolve_initial_references refer to Initial References and use the ORBInitRef and ORBDefaultInitRef arguments with the CORBA::ORB_init method.
Syntax
CORBA::Object_ptr resolve_initial_references (const char* identifier);
Input parameters
Return values
Example
#include "corba.h" ... /* assume op initialized */ extern CORBA::ORB_ptr op; CORBA::ORB::ObjectIdList *oil = op->list_initial_services(); /* pass in the first element of oil as identifier to obtain object reference */ CORBA::Object_ptr optr ; optr = op->resolve_initial_references((*oil)[0]); /* narrow optr appropriately ... */ CORBA::release(optr); ...