In this blog post I am going to show how to consume this REST Service and create a basic ADF Table.
So here is a basic REST Service for employees
REST DataControl with JSON SupportFrom „New Gallery“ open the following wizard
The create web service data control wizard launches. Choose REST option.
Next you can decide whether you consume a REST service, that has been exposed through ADF BC Application Module or a generic REST service. The difference here is that the ADF based REST service exposes additional meta data that describes the structure and types of the return JSON structure. This makes it possible to automatically get a type-aware DataControl on REST/JSON service which is generically not the case. See next screenshot to get a feel of the feature of an ADF REST Service and this particular describe feature.
So lets add an ADF REST Connection
Important note: Do include the version name and resource name, but do not include any URL parameters.
Next it is possible to choose from Security Policies
Since in this example we do not use any security just skip this page.
Next you can choose to add all resources or specific one. in this case I have only one resource exposed
Click Next and Finish.
=> The DataControl will be created. Every attribute type is correctly derived from the rest metadata (ADF REST service specific).
(Interesting to note, that EmployeeId is not marked as the primary key. Although it is in the ADF BC ViewObject definition from which the service has been previously created. Well it is because of the REST nature of this Collection. Resources typically must not match every attribute of an ADF ViewObject. It could be a subset. Therefore the canonical attribute represents the primary key which is typically the URL to the canonical resource. In our case the canonical resource is the resource itself :))
Next steps are as easy as with any other DataControl. Just create an ADF table via drag and drop
Run the page.
Table is displayed. Filtering works BTW too. Nice.
Since we are consuming an ADF REST Service lets see if we can update a record. Therefore Drag and Drop the „Commit“ Operation from the Data Control. Create a button and name it „Save changes“. For a simple testcase we change the salary from initially 10000 to 5000. Press „Save changes"
Looking into the database you will notice the change
IssuesRemoving the Filter results in an NullPointerException. Hhhm that is disappointing. Looks like nobody has tested this so far ;).
Refreshing the page the table keeps empty (Not data to display). Looks like a bug. It would not surprise me. Anyone feel free to file a SR to Oracle.
Sample applicationsProvider: enpit.sample.adf1221.restprovider.zip
ADF 12.2.1 Developers Guide:
22 Consuming RESTful Web Services Using the ADF REST Framework