About building an EJB client
A PowerBuilder application can act as a client to an EJB 1.1
or 2.0 component running on an application server that is J2EE compliant.
This capability relies on PowerBuilder extension files provided
by Sybase.
PowerBuilder extension files are developed using the PowerBuilder Native
Interface (PBNI). You do not need to know anything about PBNI to
create EJB clients, but you can read more about PowerBuilder extensions
in the PowerBuilder Extension Reference, and
about PBNI in the PowerBuilder Native Interface Programmers
Guide and Reference.
If you are developing EJB clients for EAServer,
you can use the techniques described in this chapter, or you can
create a client that uses the PowerBuilder Connection object and EAServer proxy objects.
The EJB client extension is a wrapper for Java, and therefore
provides more flexibility in communicating with EJBs. For example,
an EJB client can manipulate a Java class returned from an EJB method
call through its proxy.
The PowerBuilder Connection object has a smaller footprint
(and thus is easier to deploy) because it does not require a JRE
to be installed on the computer where the client resides. Connectivity
to the server is also faster with the connection object, because
there is no delay while a JRE loads.
For more information about building an EJB client for an EJB
component running on EAServer using
the PowerBuilder connection object, see Chapter 24, “Building an EAServer Client .”
pbejbclient125.pbx and pbejbclient125.pbd
To connect to the server and communicate
with the EJB component, clients use a set of classes implemented
in a DLL file with the suffix PBX, pbejbclient125.pbx.
To use the classes in this PBX file, you must import the definitions
in it into a library in the client application. You can also add
the pbejbclient125.pbd file, which acts as
a wrapper for the PBX file, to the target’s library search
path.
About EJB proxy objects
The PowerBuilder client uses local proxy objects for the EJB
component to delegate calls to methods on the remote EJB component.
At a minimum, each EJB component is represented in the client application
by a proxy for the home interface and a proxy for the remote interface.
For example, an EJB component named Cart has two proxies, CartHome
and Cart, each containing only the signatures of the public methods
of those interfaces.
Additional proxies are
also generated for exceptions and ancillary classes used by the
home and remote interfaces. For more information, see “Generating EJB proxy objects”.
Overview of the process
To build an EJB client, you need to complete the following
steps:
-
Create a workspace
and a PowerScript target. -
Add pbejbclient125.pbx to the
application. -
Create a project for building proxy objects.
-
Build the project to generate the proxy objects.
-
Create the windows required to implement the user
interface of the client application. -
Instantiate a Java VM.
-
Establish a connection to the server and look up
the EJB. -
Create an instance of the EJB component and call
component methods from the client. -
Test and debug the client.