
JSON web services
CICS® TG can expose web services that accept JavaScript Object Notation (JSON) as input and produce JSON responses.
CICS TG converts the JSON data into a channel or COMMAREA payload, which is then passed to a CICS program. CICS TG then converts the returned data from CICS back to JSON.

CICS TG supports two types of JSON web service, Request-Response and RESTful:
Request-Response
A Request-Response web service accepts a JSON object as input and produces another JSON object for output. The web service is implemented by a program in CICS, and CICS TG is responsible for transforming the incoming JSON object into application data and calling the program in CICS. The application returns output data back to CICS TG, and CICS TG transforms the output data into JSON data to return to the client.
In this scenario, the web service client must call the web service with the HTTP POST method.
A Request-Response mode JSON web service can be developed in either bottom-up mode or top-down mode.
In bottom-up mode, an existing CICS program is exposed as a JSON web service. CTGLS2JS is used to generate new JSON schemas that describe the inputs and outputs of the web service based on existing language structures.
In top-down mode a new JSON web service can be developed to implement an interface that is described by existing JSON schemas. In top-down mode, CTGJS2LS is used to generate new language structures, and a CICS program must be created to use them.
The Request-Response pattern can be used to build JSON web Services that target either COMMAREA or channel attached CICS programs.
RESTful
A RESTful JSON web service implements the architectural principles of the REpresentational State Transfer (REST) design pattern. This design pattern is unlikely to be relevant for existing CICS programs, so is available only in top-down mode.
A JSON schema can be processed by CTGJS2R. A CICS program must be written to implement the service and it needs to behave differently depending on the HTTP method that was used for the incoming request.
CICS TG implements a pure style of RESTful application, where the data format for POST (create) GET (inquire) and PUT (replace) are the same. RESTful JSON web service applications must use a channel-based program interface. Using a COMMAREA is not supported. This means that RESTful web services can only be implemented when CICS TG is connected to CICS using the IPIC protocol.
Generating a wsbind file
A wsbind file describes how the CICS program is called when a web service is called. A wsbind file is produced by the CICS TG JSON assistant, along with the JSON schemas (bottom-up) or language structures (top-down).



Information