With the increasing change in technology many new business applications are being written in Java or Java EE, yet core business logic often remains in CICS. Sometimes one wishes it could be possible to integrate the Java and CICS applications with minimum change. Well, with latest release of TXSeries 9.1 and CICS TG V220.127.116.11 it is indeed possible without changing your CICS applications at all!
CICS TG V9.2 Fixpack 1 provides a new resource adapter called the CICS JEE Inbound Resource Adapter. This Resource Adapter provides the capability to accept COMMAREA based LINK requests from CICS applications, invoke a method in an EJB application and return the result back to the CICS application. Using the TXSeries LINK API you could previously call C, COBOL or other supported CICS applications, now you can invoke any public method in an EJB application, and the CICS application does not need to be changed to utilize this feature. TXSeries acts as the transaction coordinator and the Java EE application server acts as a participant meaning the two separate applications will be invoked under same two-phase commit global transaction.
Interestingly, the Java EE application server can reside on any machine. You just need to configure the destination as a Communication Definition or CD entry in TXSeries and the CICS IPIC protocol will be used to connect the two systems. Once the CD entry is configured, you can use the SYSID option on the LINK command to direct a LINK to the Java EE application server where you want to invoke the EJB application. If you don’t want to specify the SYSID option on the LINK, you can specify it in the Program Definition or PD entry, meaning the CICS application does not need to be modified.
The figure below summarizes the different components involved in linking from a TXSeries COBOL program to a method in an EJB session bean deployed in a Java EE application server.
The following 5 steps summarize how to deploy the components involved into TXSeries and WebSphere Application Server (WAS).
- Deploy the CICS JEE Inbound Resource Adapter into WAS and configure it for inbound communication. This requires that the resource adapter InboundPort custom property should be set to an available port number, the default value is 2007. Restart the Java EE application server after changing the port.
- Configure a CD entry in TXSeries which points to this WAS instance. For example:
#cicsadd –r cics –P –c cd WASx ConnectionType=cics_ipic RemoteLUName="IPIC1234" RemoteNetworkName="IPIC1234" ListenerName="LD1" RemoteTCPAddress="WAS_ip_address" RemoteTCPPort=2007 SupportedRecovery=xa
In the above command, the RemoteTCPAddress should correspond to the IP address of the machine where Java EE application server is running and the RemoteTCPPort should correspond to the InboundPort specified in step 1.
- Define a TXSeries PD entry for the Java EE application you wish to invoke. The PathName should correspond to JNDI name of the EJB in WAS. For example, if the deployment descriptor of the EJB application is as follows:
<ejb-jar version="3.1" xmlns=...> <display-name>MyEJB</display-name> <session name=LinkableBean" simple-binding-name="eis/mybean"></session> </ejb-jar>
The CICS PD entry for the same should be defined as:
#cicsadd –c pd MYEJB –r region_name PathName=eis/mybean#MyMethod
- Validate the EJB. Make sure that the EJB is public and the method to be invoked follows the required convention
- Invoke the Java EE application from CICS using the EXEC CICS LINK API passing a COMMAREA as input
Other useful links