REST Services in Oracle ADF

Applications that don’t connect to other systems are slowly getting outdated. Communication is the key to any business, and this is especially true when it comes to enterprise applications as well. To tackle the ever-increasing complexity in business operations, diverse applications built on different frameworks are being used by organizations. Unless they are able to talk to each other and provide web services, they will lose relevance. In this context, we will look at how an Oracle ADF application can expose its data using REST API.

A key feature in Oracle ADF 12.2.1 is the ability to expose ADF Business Components through REST/JSON interfaces.

Oracle ADF makes it simple to expose the business component as REST services with all through a declarative set of dialogs.

Once we publish the service interface for a view object, we should be able to do the full set of CRUD operations on that object through different REST actions:

GET     –   will do a Read.

POST   –   will do a Create.

PATCH –   will do an Update.

DELETE   – will do a Delete.

It is important to specify in the header as below, to state that when we are passing JSON data back into the REST interface:

Content-Type is application/vnd.oracle.adf.resourceitem+json 

Let’s now create REST service by following below steps:

1. Create the new ADF fusion web application.

2.Create the entity-based view object (which need to be created REST Service) then assign it to Application Module. (In this example, departments table is used).

3. We must define the release version and name in adf-config.xml to create REST Web Service.

 

4. Go to Application Module and click on the green plus icon of REST tab, a dialog appears to create REST             Resource – Provide resource name and select release version.

 

5. On click of OK and IDE generates a separate project for REST Web Service and a REST Resource file under the Application Module to configure custom methods, view objects and attributes etc.

 

6. Now to run and check web service, right click on REST Web Service project and choose Run.

 

7. On running you’ll see an URL in WebLogic log tab, click on that URL, it will open HTTP Analyzer tool and can open in chrome browser.

 

 8. Now to access REST Resource we have to add version name and Resource Name in above URL like this-  http://127.0.0.1:7101/RestApp111-RESTWebService-context-root/rest/1/Dept , select GET in method and  click on Send Request button and you can check response in right panel

 

    In Chrome Browser:

 

9. We can also pass Department Id as the parameter in URL to get specific department detail

 10.We can invoke/Perform all the CRUD operations directly from POSTMAN extension of Chrome.

As you can see from above step by step illustration, we can create and deploy REST services for an ADF  application. This will increase the usability of the applications built in ADF framework and also help other  systems to communicate effectively to get things done.

This is one example where data from ADF can be shared with external world. Similarly, you can share data of any kind, i.e., employee personal information, job information, any master data stored ADF, etc.., thereby enabling collaboration across applications and improve organizational performance.

 For more information on REST services, contact us

 

Leave a Reply

Archives

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.