Sample RESTful web application for deployment to a Liberty JVM server in CICS. The application is supplied with two resources:
InfoResource
- This queries the JVM server environment using system properties and uses JAXB beans to return a JSON response detailing the CICS environment.ReverseResource
- This is similar toInfoResource
, but uses the JCICS API to link to the COBOL programEDUCHAN
using channels and containers. An input string is passed toEDUCHAN
, which is then reversed and returned, along with the time from CICS.
The following Java source components are supplied in the src/Java
directory in this repository.
CICSApplication
- Sets theApplicationPath
for resources in this applicationInfoResource
- Returns JSON structure usingCICSInformation
beanReverseResource
- Returns JSON structure usingReverseResult
bean
CICSEnvironment
- JAXB bean returning JSON structure containing information about CICS product and versionCICSInformation
- JAXB bean returning JSON structure containing CICS applid, time and JVM server name and instance ofCICSEnvironment
ReverseResult
- JAXB bean returning JSON structure containg input and output containers sent toEDUCHAN
COBOL program
DFHCSD.txt
- Output from a DFHCSDUP EXTRACT for the CICS BUNDLE resource definition.EDUCHAN.cbl
- A sample CICS COBOL that returns the date and time and reversed input using channels and containers
- CICS TS V5.1 or later, due to the usage of the
getString()
methods. - Java SE 1.7 or later on the z/OS system
- Java SE 1.7 or later on the workstation
- Eclipse with WebSphere Developer Tools and CICS Explorer SDK installed
The sample Java classes are designed to be added to a dynamic web project and deployed into a Liberty JVM server as a WAR, either using the dropins directory or using a CICS bundle project.
- Using an Eclipse development environment create an dynamic web project called
com.ibm.cicsdev.restapp
and add the Java samples to thesrc
folder - Add the CICS Liberty JVM server libraries to the build path of your project.
- Ensure the web project is targeted to compile at a level that is compatible with the Java level being used on CICS. This can be achieved by editing the Java Project Facet in the project properties.
- Create a CICS bundle project called
com.ibm.cicsdev.restapp.cicsbundle
and add a dynamic web project include for the project created in step 1.
- Enable Java support in the CICS region by adding the
SDFJAUTH
library to theSTEPLIB
concatenation and settingUSSHOME
and theJVMPROFILEDIR
SIT parameters. - Define a Liberty JVM server called
DFHWLP
using the supplied sample definitionDFHWLP
in the CSD groupDFH$WLP
. - Copy the CICS sample
DFHWLP.jvmprofile
zFS file to theJVMPROFILEDIR
directory specified above and ensure theJAVA_HOME
variable is set correctly. - Add the
jaxrs-1.1
Liberty feature toserver.xml
. - Install the
DFHWLP
resource defined in step 2 and ensure it becomes enabled.
- Using the CICS Explorer export the CICS bundle project to a zFS directory. The samples use the directory
/u/cics1/com.ibm.cicsdev.restapp.cicsbundle_1.0.0
. - Create a CICS BUNDLE definition referencing the zFS directory created in step 1.
- Install the CICS BUNDLE resource.
- Download and compile the supplied COBOL program
EDUCHAN
and deploy into CICS.
Note: sample DFHCSDUP EXTRACT output for the required CICS resource definitions is supplied in the supporting file DFHCSD.txt file.
This will invoke the InfoResource
class and return the following JSON response with information about the target CICS system:
{"applid":"IYK2Z32E","jvmServer":"DFHWLP","time":"2016-09-09T16:19:55.384Z","cicsEnvironment":{"cicsProduct":"CICS Transaction Server for z/OS","cicsVersion":"5.3.0"}}
This will invoke the ReverseResource
class which links to the CICS COBOL program and reverses the default string "Hello from Java" returning the following JSON response:
{"time":"2016-09-09T16:15:52.756Z","original":"Hello from Java","reverse":"avaJ morf olleH","truncated":false}
This will invoke the ReverseResource
class which links to the CICS COBOL program reversing the input string "ilovecics" as follows:
{"time":"2016-09-09T16:15:32.466Z","original":"ilovecics","reverse":"scicevoli","truncated":false}