REST based CRUD with Oracle ADF Business Components

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

Comments:

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.

Posted by guest on November 19, 2015 at 10:37 AM PST #

guest - yes you can use rowFinders to expose REST searches on view objects - http://docs.oracle.com/middleware/1221/adf/develop/GUID-9381734A-FB19-48F2-9B6E-CB31BC0BC98A.htm#ADFFD-GUID-F9A7846D-6B39-4107-864A-9E1993C4043B

Posted by Shay on November 19, 2015 at 11:32 AM PST #

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

Posted by Kiran on January 09, 2016 at 09:31 AM PST #

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.

Posted by Shay Shmeltzer on January 11, 2016 at 05:11 PM PST #

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.

Posted by guest on January 28, 2016 at 09:47 PM PST #

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?

Posted by guest on February 10, 2016 at 09:09 AM PST #

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.

Posted by Akhil Dua on March 19, 2016 at 04:05 AM PDT #

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

Posted by Shay Shmeltzer on March 21, 2016 at 09:14 AM PDT #

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!

Posted by guest on April 27, 2016 at 11:22 PM PDT #

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/

Posted by Shay Shmeltzer on April 28, 2016 at 09:11 AM PDT #

appreciate you share the same app deploying to glassfish server.

Posted by guest on June 25, 2016 at 04:21 AM PDT #

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

Posted by Sherif Adel on August 31, 2016 at 06:50 AM PDT #

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

Posted by Sapna on November 01, 2016 at 10:02 PM PDT #

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

Posted by sreeroop on January 21, 2017 at 10:19 PM PST #

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

Posted by guest on February 23, 2017 at 10:13 AM PST #

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

Posted by jitendra kumar Mishra on March 09, 2017 at 09:44 PM PST #

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

Posted by Orlando on March 14, 2017 at 03:38 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

me
I'm a Director of Product Management for Oracle's Cloud Development Tools and Frameworks.
Follow me:
Search


Archives
« March 2017
SunMonTueWedThuFriSat
   
1
2
3
4
5
6
8
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 
       
Today