Skip to main content

Demo.REST.MathService

class Demo.REST.MathService extends EnsLib.REST.Service

Simple REST Service in Ensemble It is a Math service with a RESTful interface returning JSON: /sum/2/3 => { "Sum" : 5 } There are two ways to call this REST interface. You can test both ways using a Browser: 1) Calling the adapter port directly http://IP:AdapterPort/sum/2/3 2) Or using the CSP Gateway mechanism. In order for this way to work, a web application has to be created first. For example, create a new web app with the following minimum parameters: Web App Name = /rest Namespace = yourNamespace Dispatch class = EnsLib.REST.Service http://IP:WebServerPort/rest/servicename/sum/2/3

Method Inventory

Parameters

parameter ADAPTER = EnsLib.HTTP.InboundAdapter;
Inherited description: Name of the adapter class - override this to "" if you want to use only the regular HTTP mechanism and not the custom-port HTTP InboundAdapter.
parameter EnsServicePrefix = |sum;
Inherited description: This prefix will be removed from the beginning of the actual URL before matching it against the UrlMap. If this prefix begins with '^' then the CSP Application will also be removed from the beginning of the URL if this service is being invoked via the CSP gateway. If this prefix begins with '|' then the Ensemble Config Name for this service will be removed from the beginning of the URL, as well as the CSP Application if this service is being invoked via the CSP gateway.

Methods

classmethod Sum(pInput As %Library.AbstractStream, Output pOutput As %Stream.Object, pnumber1 As %Integer, pnumber2 As %Integer) as %Status
This method returns the sum of pnumber1 and pnumber2

Inherited Members

Inherited Properties

Inherited Methods

FeedbackOpens in a new tab