Consume ADF BC based REST Web Service using ADF REST Data Control

Sharing is Caring

Creating and consuming web service is an important part of the development cycle in any technology. Here in this post, I am going to show that how can we consume ADF BC based REST web service in an ADF application. In ADF 12.2.1 release Oracle provides support for declaratively consuming REST Web Service, Before that it was only possible using java and that was a tedious task for fusion developers.

Suppose I have an ADF BC (Business Components) based REST web service that returns a list of Departments. Now to consume that web service we’ll use ADF REST Data control. Here I am going to illustrate this step by step.

I am using JDeveloper, Let’s start with Creating a Fusion Web Application with model and view controller project.

Fusion Web Application

Right click on the Model project and Select New–> From Gallery–> Business Tier–> Web Services and select Web Service Data Control SOAP/REST 

Create WSDL

It opens Web Service Data Control creation wizard, Select REST as Web Service type and provide a meaningful name, Select Describe-Based ADF Data Control as the type of data control.

Consume ADF BC based REST Web Service

Click on the green plus icon to create new ADF Rest Connection, Enter connection name and URL of the web service.
Here you should know that URL of ADF based REST web service typically has a host, port, context root path with version name, resource name. So URL of my web service is this

and to make it REST Describe URI just add describe after resource name and put that URL in URL Endpoint field

[amazon_link asins=’1849684820,B07DJD1Y3Q,B00D75AB6I,B00B7GHQQW’ template=’ProductCarousel’ store=’ashhish000-21′ marketplace=’IN’ link_id=’830d39b9-08dc-11e9-9b1c-4bac7dea8c52′]

Default authentication type is none so leave it and test the connection.

Create REST Connection

Click on OK and you can see that REST connection is created.

Click on next button and come to Select Resources tab and add resources to the selected side.

Select Resource in WSDL

On the Finish tab test REST connection once again and you can see It is successful.

REST Connection Successful

On the click of the finish button, a file DataControls.dcx is generated. This is a data control definition file and contains information about data collection nodes and built-in data collection operations.

Data Control

Now consuming web service part is done and next is to create a page and use WSDL to show a table on that page.

Right click on the view controller and select New–> From Gallery–> Web Tier–> JSF/Facelets and create a new page

Create jspx page in ADF

Expand Data Controls section of Fusion Web Application and you can see there Departments data collection node. On expanding it you can see the attributes of the Departments table and its operation.

Data Control of Web Service

Select Departments from data control and drop it on the page as ADF table, Also dropped Previous and Next operation as a button on the page.

Create ADF Table

Now run and check application, Data is populated from the web service using ADF REST data control

ADF table populated from REST Web Service

Click on Next button to navigate between rows

Navigation in ADF Table

All done 🙂 This is how you can consume an ADF BC based REST WebService in Fusion Application.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *