Portlet Factory, Version 6.1.2
EJB Call builder
Use the EJB Call builder to create a link to an Enterprise Java Bean (EJB). Once a link is established, your model has access to the methods associated with the bean home and remote interfaces.
The EJB Call builder is similar in function to the Linked Java Object builder. Both give you access to the methods of an external Java object. When you link to an EJB, you gain access to the bean's home and remote interfaces. The home interface includes methods for finding and creating the bean object, and the remote interface includes methods that implement the bean's business logic.
With the Linked Java Object builder, you only need to specify where its class file is located, relative to the WEB-INF\classes directory. Linking to an EJB, however, is more complicated. Beans are deployed in an application server known as the EJB container. When you configure the EJB Call builder specify the location of the application server and how it should look up the bean.
Before you try to use the EJB Call builder, verify that your system is configured properly. The EJB should be properly deployed. Please refer to you application server documentation for instructions on deploying a bean.
The EJB Call builder generates three objects: the EJB Home Interface reference, EJB Remote Interface reference, and a builder-specific helper object. These objects are all put into the model as linked objects with the following names:
- EJB Home Interface: BuilderNameHomeEJB
- Remote Interface: BuilderName
- Builder-specific helper object: BuilderNameUtil
Note: The EJB Home interface and builder-specific helper object are hidden. They are not displayed in action list choosers. However, you can use the WebAppAccess API to access them. For example, the following method supports this access:
webAppAccess.getVariables().getObject("BuilderNameHomeEJB");
Quick tips
- The data that a bean returns must be serialized. String objects may be used since they are serializable. If you need to return an XML object, create an object that implements Serializable or just return a tring object. You can call toString() on your XML object, return that, and then recreate the XML object from the string.
- Make sure IBM® WebSphere Portlet Factory is configured to communicate with the application server. To successfully link to an EJB, WebSphere Portlet Factory must be configured to communicate with the application server in which EJBs are deployed. WebSphere Portlet Factory class path must include:
- Location of the library of classes required by the application server to access the beans.
- Location of the home and remote interfaces of each deployed bean.
- For successful linking and bean access, the EJB must be running concurrently with WebSphere Portlet Factory.
Parent topic: Builder help
- About using the builder call editor
The builder call editor allows you to specify all the input values to a builder call.
- EJB Call builder inputs
This topic describes the inputs for the EJB Call builder.
- Class cast exceptions when accessing objects in a collection of entity beans
Refer to this when a class cast exception is encountered.
- Clearing a reference to the current EJB object
There are two ways you can clear an EJB object reference.
- Dealing with collections of EJBs
In the case of entity beans, you can specify a finder method that returns a collection of EJBs.
- Generating constructors for the EJB
You can leave blank either the Create Method and Create Method arguments, and/or the Finder Method and Finder Method arguments (in the case of an entity EJB).
- Setting up your EJB environment
Refer to this information when setting up your EJB environment.
- EJB Call builder: working with linked objects
To use the EJB Call builder effectively, be familiar with standard WebSphere Portlet Factory techniques for dealing with linked objects. For example, there are two ways of calling a method of the linked account EJB from within a script.
- Using existing JAR files with IBM WebSphere Portlet Factory projects
You can using existing JAR files in the Web application that you are developing.
- Linking to an EJB
You can use the EJB Call builder to link an EJB into a model.
Library | Support |