Instantiation using String_To_Object – PB Docs 125

Instantiation using String_To_Object

Obtaining proxies for SessionManager interfaces

To instantiate a proxy without explicitly using the CORBA
Naming Service, you use the String_To_Object function
of the JaguarORB object in conjunction with interfaces defined in
the SessionManager module. Before using the Manager, Session, and
Factory interfaces, you need to use the EAServer Proxy wizard
to create a proxy library project for the SessionManager module,
build the project, and include the generated proxy library in the
library list for the client target.

Identifying the server

You use the SessionManager::Manager interface to interact
with the server. You can identify the server using its Interoperable
Object Reference (IOR) or its URL. The IOR string encodes the server’s
host address and the port at which the server accepts IIOP requests.
Each time a server is started, it writes a hex–encoded
IOR string with standard encoding to two files for each listener, one
containing the IOR string by itself, and the other containing the
IOR as part of an HTML PARAM definition that can be inserted into
an APPLET tag. The files reside in the HTML subdirectory
of the EAServer directory. You
can code the client to obtain the IOR string from one of these files.

Creating an authenticated session

After initializing the ORB and obtaining the IOR or URL of
the server, use the String_To_Object function
to convert the string to a CORBA object reference that you can convert
to a reference to the Manager interface using the _Narrow function.
Then use the createSession method of the Manager
interface to create an authenticated session between the client
application and the server.

Creating a reference to the component’s interface

Use the session’s lookup method
to return a factory for proxy object references to the component
you want to call. Then 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.

A component’s default name is the package name and
the component name, separated by a slash, as in calculator/calc.
However, you can specify a different name with the component’s
com.sybase.jaguar.component.naming property. For example, you can
specify a logical name, such as USA/MyCompany/FinanceServer/Payroll.
For more information on configuring the naming service, see the EAServer documentation.

Examples

In this example, the first argument to the String_To_Object function
includes the URLs for two servers in a cluster:

In this example, the component is an EJB component. The home
interface effectively performs the same role for the EJB that the
factory interface does for a CORBA component:

note.png Using a Connection object

You can use the Lookup function on the
Connection object to obtain a reference to the home interface of
an EJB component. See “Invoking an EJB component
method”
.


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