Pages

Thursday, 5 November 2015

Creating ADFBC REST services - A new feature in Oracle JDeveloper 12.2.1

With the release of JDeveloper 12.2.1, a number of new features have come in. One particular feature w.r.t web services that has been introduced in this release is the ability to create RESTful services using ADF business components. In this blog, I will take you through the steps to expose ADFBC components as REST services.

Steps:
Create a new ADF fusion application.



Call the application ‘EmployeeDescribe’.


On the Model project, invoke the ‘Business Components From Tables’ wizard.


Connect to the DB in which you created the tables. I have used EMPLOYEES table from HR schema in my case. In Step 1 of the wizard, query and toggle the EMPLOYEES table to the RHS as shown.


In step 2, toggle EmployeesView to the RHS as shown. In Step 4, ensure ‘Add to Application Module’ is ticked. Click Finish to close the wizard.


To create the ADFBC REST service, open the AppModule by double clicking on it. Navigate to Web Service -> REST and click the plus icon. In the resulting dialog, click on the link provided.


It will take you to the adf-config.xml page. Navigate to 'Release versions' tab and create a new version.


Come back to the REST tab under App module and click the plus icon. Click Yes in the resulting dialog. Doing so will configure your application for REST services and add a new project to it.

Next, provide a name, say emp for the resource. This will expose the employee object with endpoint as emp.


Next, run the RESTWebService project. A URL gets generated in the console. Copy that to the browser and replace the last part with version/resourcename. So, the final URL may look something as below:
http://127.0.0.1:7101/EmployeeDescribe-RESTWebService-context-root/rest/rel1/emp

In the browser, a description of the emp resource is shown.
You can get the complete description of the service, by using a URL such as:

http://127.0.0.1:7101/EmployeeDescribe-RESTWebService-context-root/rest/rel1/describe


In this case, you will be able to see details about what resources the REST service exposes, the attributes that are present, their type, methods exposed etc. This is the basically a description of the REST service.
You have now successfully exposed your ADF business components as a REST service!!!

No comments:

Post a Comment