X

Shay Shmeltzer's Oracle Development Tools Tips

REST based CRUD with Oracle ADF Business Components

Shay Shmeltzer
Director of Product Management - Oracle

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

REST/JSON is the preferred interface for many client side UI technologies to access remote backend services - as examples both Oracle JET and Oracle MAF leverage REST as the way to access data from remote servers. 

Oracle ADF makes it very simple to expose your existing business components as REST services - all through a declarative set of dialogs.

Once you published the service interface for a view object, you should be able to do the full set of CRUD operation on that object through different REST action:

GET - will do a Read

POST - will do a Create

PATCH - will do an Update

DELETE - will do a Delete

One thing that you'll want to verify is that when you are passing JSON data back into the REST interface you specify in the header that:

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

otherwise you'll get an error along the lines of:

oracle.adf.internal.model.rest.core.exception.CannotParseContentException: The content type is not a ADFm REST entity. Content-Type: text/plain 

In the video below I show very quickly how to expose a REST interface and then how to invoke all the CRUD operations directly from the chrome app "Postman". 

These new feature can make your Oracle ADF business services part of any new application that prefers to use REST/JavaScript/HTML5 type of architecture.

Read more about exposing Oracle ADF BC as REST in the documentation

Join the discussion

Comments ( 18 )
  • guest Thursday, November 19, 2015

    Does the REST service published this way support filtering by specific column values, like a simple WHERE clause would?

    Thanks very much Shay :) This is very helpful. We're excited to try out the new REST support.


  • Shay Thursday, November 19, 2015
  • Kiran Saturday, January 9, 2016

    Hi,

    Thanks for sharing such a nice example. I have one question when we use POST or any opration it directly update data in database so CURD is directly happning on database whereas when we use ADF/ViewObject commit operation actually does update in database.

    So how we can achive such a functionality with ADF REST.

    Thanks

    Kiran


  • Shay Shmeltzer Tuesday, January 12, 2016

    Kiran, The update still goes through the ADF BC layer - if you have validations there they will be invoked.

    There is no commit, because in REST each request is a single transaction basically.


  • guest Friday, January 29, 2016

    Hi,

    Thanks for the very informative video.

    We are trying to expose a Database Procedure Call through ADF BC and REST, and we were able to the same successfully by doing the below steps.

    1) Created Entity Objects with procedure parameters as attributes.

    2) Overrode the doDML method of the entity to call the procedure.

    3) Created a View Object and Application Module, and created a REST service.

    I have two questions regarding the same.

    1) Is this approach correct, or do we have any other way to do so?

    2) In this case, the GET method of the REST service needs to be suppressed, is there a way to do so?

    Thanks in advance.

    Regards,

    Fahad.


  • guest Wednesday, February 10, 2016

    Shay, thanks for the helpful information. I have the basic CRUD operations working but am stuck trying to invoke non-CRUD client interface methods defined on my view objects.

    I created a VO called "AppTransactions." With a Java implementation class, I create some fairly simple custom methods and then add them to the client interface of the VO. I added AppTransactions to my application module and to my REST resources. In the VO's Rest Resources window, under the Client Interface section, I checked the boxes by my custom client interface methods.

    Now that I've gotten this far, how do I invoke these custom methods over HTTP?


  • Akhil Dua Saturday, March 19, 2016

    I does not get the option of SOAP and REST web service in 12.1.3 jdeveloper in appmodule as shown in the video.plz help asap...

    Thank You.


  • Shay Shmeltzer Monday, March 21, 2016

    Akhil - as the blog says - this feature is in 12.2.1 - you need to upgrade your JDev to get this feature.


  • guest Thursday, April 28, 2016

    To deploy ADF on the Oracle Cloud requires JDeveloper 11g (11.1.1.7.1), how to expose business components through REST with 11g? Thanks!


  • Shay Shmeltzer Thursday, April 28, 2016

    guest - Java Cloud Service supports ADF 12.2.1 and you can use JDeveloper 12.2.1 to develop for it.

    For example: https://tompeez.wordpress.com/2016/04/17/developer-cloud-service-with-jdeveloper-12-2-1-available/


  • guest Saturday, June 25, 2016

    appreciate you share the same app deploying to glassfish server.


  • Sherif Adel Wednesday, August 31, 2016

    Dear Shay

    thanks for your efforts

    i followed the example but i got the following error when trying to test service

    JBO-29000: Unexpected exception caught: java.lang.NoClassDefFoundError, msg=org/quartz/SchedulerException

    is there anything can help to solve this problem

    thanks


  • Sapna Wednesday, November 2, 2016

    Hi Shay,

    Im using JDEV 12.2.1 to consume REST web services. Have followed the following article to do the same : https://technology.amis.nl/2016/01/11/consuming-rest-service-in-your-adf-12-2-1-application/, but I get a '401 Unauthorized' error when I try to call the sample REST WS

    There are two configurations which I need in my application:

    1) I need to configure a proxy which the client can use to call the REST API. the proxy settings in jdev preferences dont seem to be picked up during the call to the WS.

    2) I need to pass certain headers to the GET/POST methods. Is there a way to pass headers to GET/POST rest webservices?

    Is there a documentation describing consumption on REST WS in jdev 12?

    Link to my post in OTN : https://community.oracle.com/message/14087286#14087286

    Thanks,

    Sapna Bhargava


  • sreeroop Sunday, January 22, 2017

    Hi Shay,

    I am using JDEV 12.2.1 to consume REST web services and I followed the your tutorial, I am getting an error message that "Data control is not found", can you help me to solve the issue.

    Thanks

    Sreeroop K M


  • guest Thursday, February 23, 2017

    Hi Shay,

    Are there any plans of introducing Batching REST API when it comes to reading data?

    Our JET application has a comprehensive dashboard presenting 10 charts. Firing a REST service request for each chart would be an overkill. We would prefer fetching all data with one single call.

    This is valid actually for complex edit pages as well: imagine a large form with 20 choice lists, where each choice list is firing a REST call.

    Of course, we can expose our own custom methods exposing the BATCH, but an out of the box solution would be make sense, don’t you think?

    Thanks,

    Florin


  • jitendra kumar Mishra Friday, March 10, 2017

    Is there a way in ADF where we can make non-POST operations use custom java or PL/SQL?

    To be specific we are looking to fire GET request with custom java or PL/SQL


  • Orlando Tuesday, March 14, 2017

    Can we send batch patch updates to ADF BC REST, something like this to

    [

    {

    "Company": "ABCDE",

    "EntityItem": "12345",

    "EntityItemType": "CON",

    "TsApprovedBy": null

    },

    {

    "Company": "DEFGH",

    "EntityItem": "100063",

    "EntityItemType": "EMP",

    "TsApprovedBy": null

    }

    ]

    I'm getting errors using POSTMAN, not sure if ADF supports this through REST?

    Regards

    Orlando


  • kp Wednesday, March 13, 2019
    Hi Shay,

    Thanks for great example above. Is there any way we can have basic authentication enabled for these webservices.
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.