Using the RESTful Web Service plugin business logic can be exposed as a RESTful Web Service.
The RESTful Web Service plugin does not contain any client side functions or properties, it is a 100% server side operating plugin.
To create a RESTful Web Service, create a form in a solution and add the following methods to the form:
- ws_read() for the GET operation
- ws_create() for the POST operation
- ws_delete() for the DELETE operation
- ws_update() for the PUT operation
In each method, add the required business logic.
The RESTful Web Service API is published on the Servoy Application Server through the url: <serverUrl>/servoy-service/rest_ws/solutionName/formName
A sample solution is included in the Servoy distribution (servoy_sample_rest_ws.servoy), detailing how to retrieve data from the http request and to return a response.
RESTful Web Services are to be stateless. As subsequent requests to the RESTful Web Service API might be handled by different headless clients in the pool of clients configured for the plugin, do not use any state in between calls to the API. This means at least the following:
- Do not use global or form variables
- Do not use the solution model API
- Do not alter the state of the a form's UI
- Do save or rollback any unsaved changes
For more information on RESTful Web Services, see:
http://en.wikipedia.org/wiki/Representational_State_Transfer
http://www.infoq.com/articles/rest-introduction
http://www.ibm.com/developerworks/webservices/library/ws-restful/
http://home.ccil.org/~cowan/restws.pdf
RESTful Web Services & [Servoy Cluster]
The RESTful Web service plugin uses a pool of headless clients to service the requests. When operated within a Servoy Cluster, note that poolsize is set per Servoy Application Server.
{column:width=80px}{column}{column}{column}
Server Property Summary
{column:width=100%}{column}
Server Property Details
Action when no more clients are availiable (block/fail/grow), default = block
Parameters
Returns
Also see
External links
Sample
Max number of clients used (this defines the number of concurrent requests and licences used), default = 5
Parameters
Returns
Also see
External links
Sample