Tutorial: REST Web Service using CORS and AJAX

Provides step-by-step instructions to define a REST Web service using the Interface Mapping Toolkit (IMTK), deploy it to an enterprise server instance, and invoke it from a Cross Origin Resource Sharing (CORS)-supported browser via an Asynchronous Javascript and XML (AJAX) request script.
Restriction: This topic applies only when the Enterprise Server feature is enabled.


  • Review the Assumptions and Before you begin a tutorial sections in the Tutorials: Interface Mapping Toolkit topic to ensure that your Visual COBOL environment is set up properly.
  • To complete this tutorial, you must have access to a browser that supports Cross-origin Resource Sharing (CORS).


This tutorial cites c:\tutorials\IMTK as the parent project directory. If you create your project in an alternative directory, please adjust the instructions as required.

Demonstration application - BookDemo

The BookDemo demonstration application represents a legacy COBOL application, meaning that this application is understood to have been in production use for some time. The application source code and project files are installed with Visual COBOL in the %PUBLIC%\Documents\Micro Focus\Visual COBOL\Samples\Interface Mapping Toolkit\ServiceInterfaces\BookDemo directory by default.

The BookDemo application is an online data application that uses an indexed file to maintain stock and inventory data such as might be in use at a book retailer. The application enables you to read, add, and delete records, and to progress from the current record to the next record. It uses the following source and data members:

Performs the four main functions of the application by receiving a user-supplied value via a linkage section, accessing or modifying the data based on the request received, and sending output data back to the user.
Called by book.cbl, book-rec.cpy contains linkage section data structures.
The data file maintained by the book.cbl program.
The data index file.


To complete this tutorial, progress through these topics in the order presented here. The bottom of each topic provides Next topic and Previous topic navigational links to help you proceed in the proper sequence: