Invoking another server component’s methods – PB Docs 125

Invoking another server component’s methods

EAServer allows the methods
of one server component to call methods of another server component.
The other server component does not need to be another PowerBuilder
component; it can be implemented in any language supported by EAServer.

Accessing a component in the current server

To access methods of another EAServer component
in the current server, you can use the Connection object to communicate
with the component, just as you would from a PowerBuilder client.
Alternatively, you can use the transaction service context object
that PowerBuilder provides called TransactionServer. The
TransactionServer interface provides a method called CreateInstance that allows
you to access other components that are available locally. CreateInstance uses
the same user and password information that applies to the component
from which it is called.

Before you can use the transaction context service, declare
a variable of type TransactionServer and call the GetContextService function
to create an instance of the service. You must use a proxy object
for your intercomponent calls. Without a proxy object, the TransactionServer
object cannot obtain the correct method names of the component you
are calling. For information on creating a proxy object for EAServer
components, see “Generating EAServer proxy objects”.

Example

In the Activate event for a component, you can call GetContextService to
instantiate the TransactionServer service:

In one of the component methods, you can then call CreateInstance to instantiate
the second component and call one of its methods. Your application should
include a proxy for the second component:

Accessing a component in a different server

The procedure for accessing a server component on a different
server is essentially the same as the procedure for accessing a
server component from a PowerBuilder client. To access an EAServer component on a different
server, create a Connection object, set properties for the Connection
object, and call ConnectToServer.

Accessing an EJB component

A PowerBuilder component can access an EJB component using
the Lookup method of either the Connection or
TransactionServer objects. The Lookup method
on the TransactionServer object has an optional third argument you
can use to specify the name of the home interface. You use this
argument only if the home interface name does not follow typical
naming conventions.

Example

This script instantiates the Cart component and invokes several component
methods. In this example, the second argument to the Lookup method
specifies the component name as well as the EAServer package
name:

For information about accessing EJB components from PowerBuilder
clients, see “Invoking an EJB component
method”
.

Component-demarcated transactions

EAServer components marked
as OTS style can create, control, and obtain information about EAServer transactions using functions
of the CORBACurrent context service object. The CORBACurrent object
provides most of the methods defined for the CORBA Current interface.

For more information, see “Client- and component-demarcated
transactions”
.


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