isCOBOL EIS : Web Service option : The Service Bridge facility : Web Service generation with isCOBOL IDE
Web Service generation with isCOBOL IDE
In order to be able to easily test our Web Service at the end of the process, create a isCOBOL Project.
1. Click File in the menu bar
2. Select New
3. Choose isCOBOL Project
Once the new project is created
1. Copy the SONGS.cbl source file to the source folder of the project
2. Right click on SONGS.cbl
3. Select Open With
4. Choose isCOBOL Service Editor
The following editor will open
1. Check the option Enable Service
If no action is taken, the Compiler generates a Web Service parameter for each elementary COBOL data item and the parameter is assumed to be input/output. In this case instead we wish to define the first group item as input, the second as i/o, and the third as output, because the archive record buffer is shared between caller and callee, while the other two parameters are one-way, so switch to the Data Map tab and
2. Delete lnk-return-status | input from the Service Fields list as we want this field only as output
3. Delete lnk-op-code | output from the Service Fields list as we want this field only as input
As soon as you save modification in this editor, the SONGS.cbl source file is automatically updated as follows:
the directive $set “servicebridge” “1” is added at the top of the source file
the directive $elk input is added on top of the lnk-op-code group item
the directive $elk output is added on top of the lnk-returns-status group item
At this point you can compile SONGS.cbl.
At the end of the compilation process, you will find two additional files in your project:
source/soapSONGS.cbl : the bridge program that allows our program to be called as Web Service, and
output/SONGS.wsdl : the XML descriptor of the service
You can start your Web Service with the following steps:
Right click on the project name
Select Run As
Choose isCOBOL EIS Servlet
We’ve just demonstrated how to create a SOAP Web Service. With the next step, we’re going to generate a REST Web Service instead. To achieve it, return to the Service Editor and change the field Type from SOAP to REST.
Note - By switching the Type value, the Settings frame content changes, allowing to set only the settings that are suitable for the selected service type.
After it, save modification and recompile SONGS.cbl to obtain the following new item in the project source folder:
restSONGS.cbl : the bridge program that allows our songs program to be called as REST Web Service.
You can start your Web Service with the following steps:
Right click on the project name
Select Run As
Choose isCOBOL EIS Servlet
Service Editor fields
In this section we map all the fields of the Service Editor with the corresponding Compiler property or directive that will be generated when you save modification.