JEE EC03Channel sample

This sample calls the CICS® program EC03 using the CICS ECI resource adapter. The program uses an enterprise bean that makes ECI calls; a client to the enterprise bean is provided.

The EC03Channel sample program includes the following files:
EC03ChannelBean.java
The implementation of the EC03 channel EJB
EC03Channel.java
The Remote interface for the EC03 channel EJB
EC03ChannelHome.java
The Home interface for the EC03 channel EJB
EC03ChannelClient.java
A basic client which calls the EC03 channel EJB
Enterprise beans have a main body of code and two interfaces. The Remote interface contains the business methods that the bean implements (in this case, the execute() method.) The Home interface manages the life cycle of the enterprise bean.

EC03ChannelClient looks up the enterprise bean as EC03ChannelHome in Java™ Naming Directory Interface (JNDI), and then narrows the search to a specific object using the remote interface as a type-cast. When execute() is called on this interface, the method is called remotely on the enterprise bean. This remote method in turn looks up the resource adapter's connection factory (an instance of the resource adapter) under the name ECI and runs EC03 in CICS, passing in a channel with one container. When the ECI call program returns, the containers returned from the program are enumerated and placed into a HashMap, which is then returned to the client.

To use the sample program:
  1. Deploy the CICS ECI resource adapter (cicseci.rar); this is located in the deployable directory of the CICS Transaction Gateway install path.
  2. Create a connection factory with parameters that are valid for your CICS server environment (on WebSphere® Application Server, these settings are on the Custom properties tab of the J2C connection factory settings). See Deploying CICS resource adapters for more information. The connection factory must have a JNDI name of "ECI" for the sample program to work.
  3. Deploy the EC03Channel sample. The sample is a file called EC03Channel.ear and is located in the <install_path>/deployable directory. The deployment process is specific to your JEE application server, but mainly involves identifying the interfaces to the deployment tool, after setting any properties you need. The properties you are asked for might include:
    Transaction type
    Can be set to container-managed or bean-managed. This determines whether you want to control transactions yourself. The JEE application server manages Container-managed transactions; if prompted, select this type for the sample program.
    Enterprise bean type
    EC03Channel is a stateless session bean.
    JNDI name
    The enterprise bean client uses JNDI to look up the enterprise bean. This allows the enterprise client to find the name of the enterprise bean in the directory.
    Resource references
    The enterprise bean refers to a connection factory. To enabled this to happen you need to add the connection factory defined in Step 2 as a resource reference for this enterprise bean.
  4. Run the Client application. You can run it from a command line, but if using WebSphere, use the launchClient utility, which sets up the necessary parameters to allow the enterprise client to look up the bean in the JNDI directory in WebSphere to find the EC03Channel enterprise bean. The application calls the bean, passing a string of text to the EC03 program, and displays the contents of the containers returned.

Information Information

Feedback


Timestamp icon Last updated: Tuesday, 19 November 2013


https://ut-ilnx-r4.hursley.ibm.com/tgzos_latest/help/topic/com.ibm.cics.tg.zos.doc//progdezos/J2EEEC03ChannelSample.html