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 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.

pbejbclient190.pbx and pbejbclient190.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, pbejbclient190.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 pbejbclient190.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:

  1. Create a workspace and a PowerScript target.

  2. Add pbejbclient190.pbx to the application.

  3. Create a project for building proxy objects.

  4. Build the project to generate the proxy objects.

  5. Create the windows required to implement the user interface of the client application.

  6. Instantiate a Java VM.

  7. Establish a connection to the server and look up the EJB.

  8. Create an instance of the EJB component and call component methods from the client.

  9. Test and debug the client.