This topic explains how to configure and apply the EJB Client tool that invokes methods of EJB remote objects deployed on a J2EE application server. Sections include:

Understanding the EJB Client Tool

The EJB Client obtains an EJB Remote Object via a JNDI query or from the Object Data Bank. It can then be used to invoke methods on that object. The return values of those methods can then be passed to a chained tool, such as a Diff or an Object Data Bank.

In order to invoke an EJB Client tool on a certain method of an EJB remote object, you must tell the tool the source of the remote object. An EJB remote object can either be obtained from a remote directory via a JNDI query, or from SOAtest's local Object Data Bank. In the latter case, the EJB remote object should be put into the Object Data Bank as a return value from a previous EJB Client tool invocation.

The EJB Client tool must obtain the EJB Remote Object via JNDI query at least once. Subsequently, you can obtain the same EJB Remote Object via the Object Data Bank. This avoids multiple JNDI queries for the same EJB Remote Object.

For stateful EJBs in EJB 2.0, use chained Object Data Bank tools to store the returned EJB objects. This enables their methods to be invoked in subsequent tests.

Configuring the EJB Client Tool

The options of the EJB Client tool will vary depending on where the EJB remote object is obtained from (from a JNDI Query or from an Object Data bank).

Obtaining EJB Remote Object from JNDI Quer

In order to obtain an EJB Remote Object from a JNDI Query, select the JNDI Query radio button from the EJB Remote Object Source area and configure the following parameters:

Obtaining An EJB Remote Object from an Object Data Bank

Before you can obtain an EJB Remote Object from an Object Data Bank (so it can be used in subsequent tests), you must first store a return value in an Object Data Bank. To do this:

  1. Right-click the EJB Client Tool node and select Add Output> Object Output> New Output> Object Data Bank.
  2. In the Object Data Bank control panel, specify a unique Column Name by which this value can be later queried.

Once a value is stored in an Object Data Bank, select the Object Data Bank radio button from the EJB Remote Object Source sub panel of the EJB Client tool and configure the following parameters:

Viewing the Data Bank Variables Used During Test Execution

You can configure the Console view (Window> Show View> Console) to display the data bank variables used during test execution. For details, see Console view.

Using Regression Controls

To create or update regression controls for a set of EJB Client tool tests, right-click on the test suite encompassing the tests and select Update or Create Regression Controls from the shortcut menu. Select Multiple Controls if you are using data sources.

Invoking EJBs Deployed on IBM WebSphere Application Server (WAS)

To invoke an EJB deployed on the WebSphere Application Server (WAS) using the Sun JRE shipped with SOAtest, some special configuration is necessary. All other configuration settings explained in this document apply. To configure SOAtest, complete the following:

  1. Use the Sun Initial Context Factory (com.sun.jndi.cosnaming.CNCtxFactory):  This setting should be configured in the EJB Client's JNDI properties. This setting requires that Sun's j2ee.jar is on the SOAtest classpath. This .jar file is available from the Oracle Java site. For more information on adding class files to SOAtest, see System Properties Settings.

  2. In the EJB Clients's JNDI properties, use a provider URL in the form of corbaloc:iiop:WAS:2809 where WAS is the location of your WebSphere Application Server.(for example, corbaloc:iiop:bison:2809)
  3. In the EJB Client's JNDI properties, specify the Object Name in the following format: cell/nodes/[node]/servers/[server]/YOUR_EJB_OBJECT_NAME (for example, cell/nodes/bisonNode01/servers/server1/ejb/BasicCalculator)

Using XML Encoder/Decoder with the EJB Client

The XML Encoder and XML Decoder are complementary tools which allow you to transfer a Java Bean object graph into an XML representation (XML Encoder) or transfer a compatible XML output to a Java Bean (XML Decoder).

The XML Encoder and XML Decoder tools can be particularly useful when creating EJB Tests. An XML Encoder can be used to transform the Java Bean Object Output of an EJB Tool to an XML format. This output can be further manipulated by other SOAtest tools, such as XML Transformer, to extract or modify portions of the XML document that are of interest to you. The modified XML output can then be transformed back to Java Bean format with the help of the XML Decoder. The result can be chained to the Object Data Bank—thus making it possible for the subsequent tests to use the modified Java Bean object as a Tool input.

Please keep in mind that the EJB Tool conveniently allows you to add chained Tools to its XML or Object outputs. The XML Output of the EJB Tool is an Object Output transformed by an XML Encoder.