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 some PowerBuilder extension files.
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.
pbejbclient170.pbx and pbejbclient170.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, pbejbclient170.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 pbejbclient170.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 pbejbclient170.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.