The ECI channels and containers sample uses JCA to send
an ECI request to a sample channel program in CICS® called EC03. The CICS EC03 sample program adds containers to
the channel which is then returned.
The sample can call the CICS sample
program EC03, either through the ECI resource adapter, or through
the ECI XA resource adapter. The sample includes a client application
that invokes an enterprise bean. The enterprise bean then issues the
ECI request to CICS.
The sample 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 handles the
life cycle of the enterprise bean.
EC03ChannelClient looks up the enterprise bean as EC03ChannelHome
in the JNDI (Java™ Naming Directory
Interface). It then locates an 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. The remote method then
looks up the resource adapter connection factory (an instance of the
resource adapter) under the name ECI. The method 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 back to the client application that issued the call.
To use the sample:
- Deploy the CICS ECI
resource adapter (cicseci.rar); this is located in the deployable
directory of the CICS Transaction
Gateway install path.
- Create a connection factory with parameters to suit your CICS server environment. For more information see Deploying the CICS resource adapter.
Note: The
connection factory must have a JNDI name of ECI for the sample to
work.
- Deploy your enterprise bean. This automatically generates code
that handles remote method calls to your enterprise bean that are
made by the enterprise bean client. This 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 will be asked for might include:
- Transaction Type
- This can be set to container-managed, or bean-managed, and determines
whether you want to control transactions yourself. The JEE application
server manages Container managed transactions. If you are prompted,
select Container managed for the sample.
- Enterprise bean Type
- EC03Channel is a stateless session bean.
- JNDI Name
- The enterprise bean client uses JNDI to look up the name of the
enterprise bean in the naming directory.
- Resource References
- The enterprise bean refers to a connection factory. You must add
the connection factory (as defined in step 2) as a resource reference
for this enterprise bean.
- Run the client application. You can run the client either from
the command line or with the launchClient utility (if you are using WebSphere® Application Server).
The launchClient utility sets up the necessary parameters to communicate
with the JNDI directory in WebSphere to
find the EC03Channel enterprise bean. The application calls the bean,
passes a text string to the EC03 program, and displays the contents
of the container that the EC03 program returns.