Follow by Email

Wednesday, 30 December 2015

Create REST Web Service with Application Module declaratively in ADF 12.2.1

REST stands for Representational State Transfer, REST is an architectural style not a protocol as SOAP that's why it can use any other protocol like SOAP, HTTP etc.
REST requires less bandwidth and resources (lighter) than SOAP

New ADF 12.2.1 supports creating RESTful web services directly from Application Module, In previous versions we have to do everything manually
See- Create RESTful services on top of ADF Business Components

But in new release Oracle mentioned this -

ADF Business Components now offers the ability for users to declaratively expose their data model as RESTful web services. Users can decide on the set of attributes to expose from backing view object instances, the actions to make available, and the view link relationships to preserve for the resulting resource.

  • Created a Fusion Web Application using Departments table of HR Schema

  • Open Application Module and click on Web Service tab, there is a separate tab for REST, Click on green plus icon- It show an error dialog that asks to define a version

  • We have to define release version and name in adf-config.xml to create REST Web Service

  • Again go back to Application Module and click on green plus icon of REST tab, a dialog appears to create REST Resource - Provide resource name and select release version

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

    REST Resource file -
  • Now to run and check web service ,Right click on RESTWebService project and choose Run

  • On running you'll see an URL in weblogic log tab, click on that url, it will open HTTP Analyzer tool

  • Now to access REST Resource we have to add version name and Resource Name in above url like this- , select GET in method and  click on Send Request button and you can check response in right panel

  • We can also pass Department Id as parameter in url to get specific department detail

All Done :) Sample ADF Application - Download
Cheers :) Happy Learning

No comments :

Post a Comment