Creating a Request-Response JSON web service from JSON Schemas
How to create a Request-Response JSON web service, starting from JSON Schemas.
Procedure
- Create JSON Schemas to describe the format of the request and response JSON data.
- Run the JSON web services assistant to create a WSBind file and high-level language structures.
- Write a CICS® program using the generated high-level language structures that implements the business logic for the JSON web service.
- Configure CICS Transaction Gateway with a HTTP or HTTPS protocol handler and a JSON web service using the generated WSBind file. For more information, see Configuring JSON web services.
- Start CICS Transaction Gateway and test that you can invoke the JSON web service.
The JSON assistant
Run the CICS TG JSON web services assistant by customizing and submitting the sample CTGJS2LS JCL. The assistant generates WSBind file and high-level language structures from the JSON Schemas provided. CTGJS2LS contains the required parameters for creating a Request-Response JSON web service WSBind file from JSON Schemas. Consider these options when you are creating a new application for web services:
- Which mechanism will CICS TG use to pass data to the CICS program? You can use a channel and pass the data in containers or use a COMMAREA. Specify them with the PGMINT parameter.
- Which language do you want to generate? CTGJS2LS can generate COBOL, C/C++, or PL/I language data structures. Specify the language with the LANG parameter.
Writing the CICS program
If the program interface is COMMAREA, the CICS program can be written in the same way as any other COMMAREA-based program. The data that is passed in the COMMAREA conforms to the language structure generated by the JSON web services assistant.
If the program interface is channel,
the data is passed in a single BIT container, which is named DFHWS-DATA
by
default. To use a container with a different name when you run CTGJS2LS, specify the CONTID parameter.
The data in the container conforms to the language structure generated
by the JSON web services assistant.
The data is aligned differently depending on the value of TARGET-CICS-PLATFORM, for more information, see Creating a Request-Response WSBind file from JSON Schemas.