Question
· May 18, 2016

How can I accept HTTP requests from Ensemble?

I need to call Ensemble Business Operation by sending authorised (basic auth, cache user) HTTP request (REST-like). How can I achieve that?

Maybe configure a Business Service, but which one has this functionality?

Discussion (3)0
Log in or sign up to continue

You should use an Ensemble REST web service which is a sub-class of EnsLib.REST.Service

I would recommend starting with reviewing the documentation on CSP REST services which can be found at the link below.  This will give you a basic understanding of how Ensemble implements RESTful web services.

http://docs.intersystems.com/ens201513/csp/docbook/DocBook.UI.Page.cls?K...

There is also an extension of the HTTP adapter that provides an interface for providing RESTful web services as part of your production.  The documentation on how to implement this can be found here:

https://community.intersystems.com/product-documentation/creating-rest-s...

Actually, the best practice for Ensemble is now to  subclass %CSP.REST directly and call the Ens.Director.CreateBusinessService() method to instantiate the class as a business service.  The next revision of the Ensemble documentation will have the following note:

Although Ensemble defines a class EnsLib.REST.Service, that is a subclass of %CSP.REST, we recommend that you not use this class because it provides an incomplete implementation of %CSP.REST. The only feature that EnsLib.REST.Service provides that is not available from %CSP.REST is the ability to use a special port, but we recommend against using a special port because it does not provide the robustness and security you get by using a commercial web server and the CSP port. 

If you  just want to pass through a REST call to a REST business operation, you can use EnsLib.REST.GenericService.

The ENSDEMO Demo.ZenService.Zen.WeatherReportForm.cls demonstrates how to use CreateBusinessService  with Zen not REST, but the use of CreateBusinessService is the same.