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 to InfoResource
, but uses the JCICS API to link to the COBOL program EDUCHAN
using channels and containers. An input string is passed to EDUCHAN
, which is then reversed and returned, along with the time from CICS. The following Java source components are supplied in the src/main/java
directory in this repository.
CICSApplication
- Sets the ApplicationPath
for resources in this applicationInfoResource
- Returns JSON structure using CICSInformation
beanReverseResource
- Returns JSON structure using ReverseResult
beanCICSEnvironment
- 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 of CICSEnvironment
ReverseResult
- JAXB bean returning JSON structure containg input and output containers sent to EDUCHAN
COBOL programDFHCSD.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 containersbuild.gradle
- A sample Gradle build file to enable an automated build of the deployable WARpom.xml
- A sample Maven build file to enable an automated build of the deployable WARgetString()
methods.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.
com.ibm.cicsdev.restapp
and add the Java samples to the src
foldercom.ibm.cicsdev.restapp.cicsbundle
and add a dynamic web project include for the project created in step 1.The sample can be built using the supplied Gradle or Maven build files to produce a WAR file and optionally a CICS Bundle archive.
Run the following in a local command prompt:
gradle clean build
This creates a WAR file inside the build/libs
directory and a CICS bundle ZIP file inside the build/distributions
directory.
If using the CICS bundle ZIP, the CICS JVM server name should be modified in the jvmserver
property in the gradle build properties file to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line as follows.
gradle clean build -Pjvmserver=MYJVM
Run the following in a local command prompt which will create a WAR file for deployment.
mvn clean verify
This creates a WAR file in the target
directory.
If building a CICS bundle ZIP the CICS bundle plugin bundle-war goal is driven using the maven verify phase. The CICS JVM server name should be modified in the pom.xml
to match the required CICS JVMSERVER resource name, or alternatively can be set on the command line as follows.
mvn clean verify -Djvmserver=MYJVM
SDFJAUTH
library to the STEPLIB
concatenation and setting USSHOME
and the JVMPROFILEDIR
SIT parameters.
DFHWLP
using the supplied sample definition DFHWLP
in the CSD group DFH$WLP
.DFHWLP.jvmprofile
zFS file to the JVMPROFILEDIR
directory specified above and ensure the JAVA_HOME
variable is set correctly.jaxrs-1.1
(or later version) Liberty feature to server.xml
depending on your version of Java EE.DFHWLP
resource defined in step 2 and ensure it becomes enabled./u/cics1/com.ibm.cicsdev.restapp.cicsbundle_1.0.0
.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}