Creating REST Services in Productions
This article describes briefly how to create a Business Service that is also a REST service. This REST service will be able to receive REST requests and pass them to a Business Process or Business Operation elsewhere in the production.
The approach varies by your needs. If you want to:
Parse and process the request in the production — use a subclass of %CSP.RESTOpens in a new tab and call the Ens.Director.CreateBusinessService() method to instantiate the class as a business service. This service uses the Web port. For details on implementing a subclass of %CSP.RESTOpens in a new tab, see Creating REST Services.
Pass through a REST URL to an external server with minimal changes — use the pass-through REST service, EnsLib.REST.GenericServiceOpens in a new tab. For details on using the pass-through REST service, see the sections on pass-through business services in “Configuring ESB Services and Operations” and “Pass-through Service and Operation Walkthrough” in Using a Production as an ESB.
InterSystems IRIS provides a built-in business service, EnsLib.REST.ServiceOpens in a new tab, that can be used instead of subclassing %CSP.REST. Because this business service works with the HTTP/REST inbound adapter, the dispatch methods receive additional arguments containing the input and output streams that the HTTP Adapter relies on. Classes receiving forwarded <Map> requests should extend %CSP.REST and not EnsLib.REST.Service.