Mainframe CICS TG - API Exercise

Mainframe CICS TG - API Exercise

Introduction

This exercise will develop your skills with OpenLegacy IDE by generating Java models from existing SDK and creating API controller to validate end to end process .

Pre-Requirements

  • OpenLegacy IDE 4.5.2 (Full installation including JDK and all Maven dependencies).

  • Mainframe CICS TG - SDK Exercise

  • Internet Connection

Exercise Definition

  • Create a new API Project.

  • Generate API from existing SDK project.

  • Test the API with swagger.

Step 1 – Create a New API Project

First, we will create a new API project using OpenLegacy IDE.
The purpose of the API project is to allow easy end to end access in to legacy backends, using standard and easy to use Java code.

Project Setup

Create a new OpenLegacy API project.

  1. Open the New Project Wizard (you have three options):

    • File → New → OpenLegacy API Project

    • Alt+Shift+N → OpenLegacy API Project

    • File → New → Project → Select OpenLegacy API Project from the drop-down

  2. Define the project name and the default package

  3. Click at the Default Package field, to automatically fill it up.

  4. Press Next and add the SDK project that was created in SDK exercise as the reference project.

  5. Clean the project

Step 2 – Generate API from SDK

  1. Right-Click on the API project → OpenLegacy → Generate API from SDK

    1. Name the service

    2. Select from the Fininq2 model the custId as input and change its name to customerId for better readability

    3. Select from the Fininq2 model the creditCards as output

    4. Click OK

  2. Uncheck Use Input wrapper AND default method

  3. in the Method Tab, change the HTTP Method to GET. define the Method path as /{customerId} to align with REST best practices and save the changes

 

Step 3 – Run and Test your API

  1. Right-Click on the API project → OpenLegacy → Run Application

  2. Open the browser on http://localhost:8080/swagger

  3. Authorize through Oauth2

    • Client Id: client_id

    • Client Secret: client_secret

  4. Click on the API we've created → Try it out

    • Set dummy customer ID as input (for example: 412-83254)

    • You should see successful respond returned directly from the mainframe CICS program FININQ2!

 

Summary

In this exercise we have presented an end to end integration with Mainframe CICS TG using Openlegacy IDE within just a couple of minutes.
We have started from a COBOL source of a program(SDK exercise) we wanted to expose and automatically generated Java SDK that enables calling the underlying program, then we have presented the creation of a REST API utilizing the Mainframe CICS TG SDK.
We used the IDE to better model and design the API and showed how it works with a standard Swaager page.