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


Library | Support |