Instantiation using the naming service API – PB Docs 125

Instantiation using the naming service API

Obtaining proxies for CosNaming and SessionManager interfaces

To instantiate a proxy using the CORBA naming service API,
you need to generate proxies for the naming service interface and
include these proxies in the library list for the client. Use the EAServer Proxy wizard to create
a proxy project for the CosNaming module, build the project to create
a proxy library, and add the proxy library to the client target’s
library list. You also need a proxy for the SessionManager module.

Getting an initial naming context

After initializing the ORB, call the Resolve_Initial_References function
to obtain an initial naming context and use _Narrow to
convert it to a reference to the CORBA naming context interface.
You must identify the CosNaming package by including omg.orb in
the class name as shown in the example below.

Resolving the naming context

You need to resolve the naming context to obtain a reference
to a Factory object for the component and then narrow that reference
to the SessionManager::Factory interface. The resolve method
takes a name parameter, which is a sequence of NameComponent structures.
Each NameComponent structure has an id attribute
that identifies the component and a kind attribute
that can be used to describe the component. In the example below,
the name has only one component.

Creating a reference to the component’s interface

Call the create method of the Factory object
to obtain proxies for the component. The create method
returns a CORBA object reference that you can convert into a reference
to the component’s interface using the _Narrow function.

Example

The NamingContext and NameComponent types used in the example
are proxies imported from the CosNaming package in EAServer, and the Factory type is
imported from the SessionManager package:


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x