Please disable your adblock and script blockers to view this page

Search this blog

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- http://127.0.0.1:7101/RestWebServApp-RESTWebService-context-root/rest/Jdev12.2.1/Department , 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

5 comments :

  1. Excellent post, Ashish, thanks.

    Unfortunatelly I'm stuck deploying it in Glassfish+ADF Essentials (https://community.oracle.com/thread/4082124)

    Any guidance?
    Thanks in advance,
    Jose.

    ReplyDelete
  2. This is simply because I didn't check the "Notifiy Me" in my previous post:-)

    ReplyDelete
  3. Thanks you very much sir, keep posting these kind of blogs ,eagerly waiting for your blog on How to make data control using Java beans , need to know the logic behind making this..!!
    Thanks for Sharing..!!

    ReplyDelete
    Replies
    1. gupta just click on your class and select generate Data Control (Y)

      Delete
  4. Hi,
    Is there any possibility to expose VO's as REST resources programmatically? I'm building VO's at runtime based on SQL queries and I need to expose them as REST.

    Thanks.

    ReplyDelete