You are on page 1of 3

Overview (/community_groups/mobile/) Forum (/community_groups/mobile/f/17) Wiki (/community_groups/mobile/w/mobile) Documents (/community_groups/mobile/m/documents)

Ideas (/community_groups/products_enhancements/i/mobile) Blog (https://blogs.progress.com/)

REST Generic Service for the JSDO (/community_groups/mobile/m/documents/2190/download)

The REST Generic Service for the JSDO implements the Cloud Data Object (CDO (http://clouddataobject.github.io/CDO/)) protocol using a REST Service instead of a Mobile Service.
This service only needs to be deployed once and can be used as a proxy to access data from multiple tables.

This example implements the following operations:


- catalog
- resource (READ)

The KendoUIGrid.html file included in the zip file shows how to use the Generic Service to access data in the Customer table.

This prototype should be a good starting point for anybody wanting to implement a generic / dynamic service.

The prototype only shows access with one database and only READ operations (it can use the filter parameter with a WHERE clause).

Some items for a future version of the Generic Service would be to support the rest of the CRUD operations, use the Abstract Business Entity introduced in 11.4 and also support the JSON Filter
Pattern that we have for paging (with count support) and sorting. Also, support for custom Business Entities.

The prototype is a REST Service that implements a Generic Service that can be used from OpenEdge Mobile (JSDO), Kendo UI and Rollbase (via the OpenEdge Service Objects functionality).

The Generic Service generates the catalog for a table and gives access to its data.

The Generic Service provides the catalog and the data dynamically saving you from having to generate Business Entities for each table that you want to make available. From the client point of
view, it looks like a Business Entity.

Please notice that even though the service behaves as a Mobile Service from the point of view of the JSDO, it is not a REST Service.

To use the Generic Service, you would just need to create a REST project in Progress Developer Studio and map the procedures "catalogForTable" and "readTable" to using the REST Resource
URI Editor (Defined Services -> Edit):
/catalog/{tableName} --> catalogForTable
/catalog/{tableName}?filter={filter} ---> readTable

The input parameters are in the PATH and are mapped to the corresponding parameters in the procedure.
The output parameter jsonText should be mapped to the Body of the response.

Screenshots for readTable:


(/cfs-file.ashx/__key/communityserver-components-userfiles/00-00-00-25-30-attached+files/image1.png)

(/cfs-file.ashx/__key/communityserver-components-userfiles/00-00-00-25-30-
attached+files/image2.png)

(/cfs-file.ashx/__key/communityserver-components-userfiles/00-00-00-25-30-
attached+files/image3.png)
You can test the generic service (dynamic service) using a URL like the following:
To access the catalog:
http://localhost:8980/GenericService/rest/GenericService/catalog/Customer

To access the data:


http://localhost:8980/GenericService/rest/GenericService/resource/Customer
http://localhost:8980/GenericService/rest/GenericService/resource/Customer?filter=CustNum%3C10

Note: If you want a formatted version of the data that is returned, you can use the JSONLint web site to format it:
http://jsonlint.com/

An instance of the Generic Service is available live at the oemobile demo machine.

Example:
serviceURI: http://oemobiledemo.progress.com/GenericService
catalogURI: http://oemobiledemo.progress.com/GenericService/rest/GenericService/catalog/SalesRep

URI for data:


http://oemobiledemo.progress.com/GenericService/rest/GenericService/resource/SalesRep

An instance of the Generic Service is used in the examples for using Kendo UI:
- Example KendoUIBarChart.html.( http://oemobiledemo.progress.com/jsdo/example016.html )

White paper:
https://community.progress.com/community_groups/openedge_development/m/documents/2135.aspx
Examples:
https://community.progress.com/community_groups/openedge_development/m/documents/2020.aspx

Bookmark this media Like

4
rate

ShareThis Copy and Paste

You might also like