How the z/VSE Host Can Act As the REST Server
Figure 1 shows how REST can be used in a CICS TS environment when the z/VSE host acts as the REST server that provides RESTful web services.
For z/VSE as a RESTful web service provider (server),the HTTP request is received by CICS Web Support (CWS). The URL to start a z/VSE provided RESTful web service must look as follows:
http://host:port/cics/CWBA/IESRESTS/userprog[/resource-uri][?query-string][#fragment]
This URL tells CICS Web Support to call program IESRESTS (which is the server part of the z/VSE REST engine) under the CICS supplied transaction CWBA. The name of the user-provided program, which implements the RESTful web service, is specified as part of the URL as shown above. The REST engine performs data translation based on the content type, as well as parsing (for XML or JSON type data). The REST engine then calls the user-provided program and passes the HTTP request type (GET, PUT, POST, DELETE, etc), the resource-uri (if specified), query string containing URL parameters (if specified), additional HTTP headers (if specified), the content type of the payload, and the payload itself (as buffer in memory or as parsed XML- or JSON-tree). The user-provided program uses the passed information and performs the desired action and finally returns back to the REST engine. It passes back the response code, response content type and response payload. The REST engine then performs data translation based on the response content type, as well as XML or JSON data generation and sends the response back through CICS Web Support to the REST client on the remote system.