Wednesday, October 28, 2015

ADF 12.2.1 ADF BC Support for REST

ADF 12.2.1 provides out of the box support for REST. You should read about all available REST functionality in ADF BC here - 16 Creating RESTful Web Services with Application Modules. I have created very quick sample application to test how it works.

Before generating REST on top of ADF BC, you must configure release version for REST. This can be any number:


To generate REST, go to REST Web Service interface in Application Module and add new REST resource. Here you can select VO and provide REST resource name:


JDeveloper generates REST resource where you could configure attributes to expose, custom methods, etc.:


As soon as you generate REST resource on top of ADF BC, JDeveloper creates new project with web.xml. You could use this project to run/test REST (simply right click and choose Run to test on integrated WLS):


I can test REST through URL: http://127.0.0.1:7101/restapp/rest/1/Employees, ADF returns well structured REST response:


ADF is smart to return only a subset of data, it offers a parameter to control how many rows to fetch in a single call, it also shows if there are more rows to be returned in the result set:


I can set limit parameter to retrieve only one row, this is how it works:


Download implemented sample application - ADFBCRestApp.zip.

6 comments:

Unknown said...

Hi Andrejus,

How can I retrive all rows in a single call with out using limit parameter.

Regards,
Vikram

Andrejus Baranovskis said...

Try to use limit = -1 or set -1 for Range Size in ADF BC REST collection definition.

Regards,
Andrejus

Daniel said...

Hi Andrejus,

How can I change the connection to my Database, but instead of using a direct connection (Business Components) using a Weblogic DataSource?

Thanks
Daniel

Andrejus Baranovskis said...

You can type Data Source name into AM config (use Data Source in ADF BC).

Regards,
Andrejus

Daniel said...

Only that?
In previous version I had to remove the connection, change bc4j and web.xml files to reference the datasource.

By any chance do you have any step by step?

Thanks
Daniel

Andrejus Baranovskis said...

Yes, is pretty simple in new versions. You dont need to remove connection or change anything in bc4j or web.xml. I think it is documented in ADF developer guilde.

Andrejus