Each EAServer component has a corresponding proxy object in the client application. To access an EAServer component, you need to communicate through the EAServer proxy.
An EJB component has two corresponding proxy objects in the client application—one for the home interface and one for the remote interface. For example, an EJB component named Cart produces two proxies, CartHome and Cart. To access an EJB component, you need to communicate through these two proxies.
Before you can generate proxy objects for an EAServer client, you need to create a new project. The new project lists the objects that will be included and specifies the name of the output library that will contain the generated proxy objects.
The EAServer Proxy wizard helps create projects for building EAServer proxy objects. It allows you to connect to EAServer and select the components you want to be able to access from the client. Once you have created the project, you can then use the Project painter to modify your project settings and build the proxy library.
Building EJB clients To build an EJB client that can use the services of an EJB component on EAServer and other J2EE-compliant servers, you can use the EJB Client Proxy wizard. For more information, see Chapter 29, “Building an EJB client.”
When you generate a proxy for an EAServer component that was not created in PowerBuilder, the names of any methods that use a PowerBuilder reserved word are changed. The proxy generator automatically adds an underscore (_) prefix to these methods. For example, if the component has a method with the name destroy, the method in the proxy will be _destroy.
When you generate a proxy for a PowerBuilder component containing
an array that uses a TO clause, the proxy object
represents the range as a single value because CORBA IDL does not
support the TO clause. For example, Int
ar1[5 TO 10]
is represented
as Int ar1[6]
,
with [6]
representing
the number of array elements. Client applications must declare the
array using a single value instead of a range.
You can choose to prepend the name of the IDL module that
defines the component to the name of the proxy object created, which
makes it easier to identify proxy objects with similar names. For
example, if you select the SessionInfo component in the CTSSecurity
module and check the Prepend EAServer Package
Name to Object Name option in the wizard or Project painter, the
proxy object will be named ctssecurity_sessioninfo
.
For some EAServer system modules,
currently CtsComponents and XDT, the module name is always prepended
to objects to avoid naming conflicts.
The package name and the name of the IDL module are often the same, but they can be different, and it is always the name of the IDL module that is prepended.
Many EAServer components throw exceptions that you can handle in your client application. If you want to use the proxy you are generating with an existing client application that does not handle exceptions, or if you do not want to declare the exceptions in the client you are building, you can choose to exclude exceptions from the generated proxy, either in the wizard or in the Project painter. See “Handling errors” for more information about handling errors in clients.
All EAServer component interfaces are defined in standard CORBA IDL. For a list of datatypes used in EAServer, their CORBA IDL equivalents, and the PowerBuilder datatypes to which they map, see the PowerScript Reference or the online Help.