Using the build toolkit to generate artifacts from the Swagger file

Run the build toolkit command line interface (CLI) to generate artifacts for the API requester.

About this task

zosConnect-2.0 Applies to zosConnect-2.0.

For this scenario, we use the CLI of the build toolkit to generate all the artifacts to enable the client IMS or z/OS® application to call the contacts API. These artifacts include an API requester archive (.ara file) and a summary report for the catalog manager API, and API information files, data structures, and logs for each operation in the API. In this task, you will use the build toolkit to create these artifacts from the phonebook.json Swagger file that is obtained in the prerequisite task. For more information, see Using the build toolkit to generate artifacts for an API requester.

Procedure

  1. Create a local directory called buildToolkit under the /u/{userid} directory.
  2. Copy the build toolkit compressed file, zconbt.zip as a binary file, from the product installation directory and extract the zconbt.zip file to the buildToolkit directory.

    You can use the java jar command to extract zip files.

  3. Create directories and data sets for the artifacts to be generated.
    1. Create a directory called apiReqScenario under the /u/{userid} directory to store the phonebook.json file.
    2. Create a directory called archives under the apiReqScenario directory to store the generated API requester archive and summary report.
    3. Create a directory called logs under the apiReqScenario directory to store the generated log file for each operation defined in the API.
    4. Create a data set on MVS to store the generated API information file and data structures, for example, TEST.PHBK.COBOL.
  4. Upload the phonebook.json file, as a binary file, to the apiReqScenario directory.
  5. Create a local properties file named phonebook.properties and enter the directory or data set names and other attribute values:
    
    apiDescriptionFile=../apiReqScenario/phonebook.json
    dataStructuresLocation=TEST.PHBK.COBOL
    apiInfoFileLocation=TEST.PHBK.COBOL
    connectionRef=RemoteAPIconn
    logFileDirectory=../apiReqScenario/logs
    language=COBOL
    requesterPrefix=PHB
    The default prefix is API. For this example, we specify PHB.
  6. Upload the phonebook.properties file, as a binary file, to the apiReqScenario directory.
  7. Enter the buildToolkit directory and enter the zconbt.zos command:
    
    ./bin/zconbt.zos --properties ../apiReqScenario/phonebook.properties --file ../apiReqScenario/archives/phonebook.ara
        
  8. When processing of the command is completed, a message is returned, indicating whether the artifacts were built successfully. If any errors occur, make the necessary corrections and repeat the procedure.

Results

Several artifacts for the API requester are created in the directories as you have configured. For each API an API requester archive (.ara) file and a summary report are generated. For each API operation, an API information file, request data structures, and response data structures are generated. The following table shows the directory structure (/ data set) and contents created:
Table 1. Directory paths (/ data sets) and contents
Path (/data set) Contents
./apiReqScenario/
  • Directory archives
  • Directory logs
  • phonebook.properties
  • phonebook.json
./apiReqScenario/archives
  • phonebook.ara: the API requester file that can be deployed to the IBM® z/OS Connect Server.
  • phonebook-summary.txt: the summary report that contains information about all the data structures and API information file.
./apiReqScenario/logs Logs for each operation defined in the contacts.json file.
TEST.PHBK.COBOL
  • PHB00I01.cbl: the API information file of the postPhonebookService operation
  • PHB00P01.cbl: the response data structure of the postPhonebookService operation
  • PHB00Q01.cbl: the request data structure of the postPhonebookService operation
  • PHB01I01.cbl: the API information file of the getPhonebookService operation
  • PHB01P01.cbl: the response data structure of the getPhonebookService operation
  • PHB01Q01.cbl: the request data structure of the getPhonebookService operation
  • PHB02I01.cbl: the API information file of the putPhonebookService operation
  • PHB02P01.cbl: the response data structure of the putPhonebookService operation
  • PHB02Q01.cbl: the request data structure of the putPhonebookService operation
  • PHB03I01.cbl: the API information file of the deletePhonebookService operation
  • PHB03P01.cbl: the response data structure of the deletePhonebookService operation
  • PHB03Q01.cbl: the request data structure of the deletePhonebookService operation