Home » Java » Enterprise Java » Consuming JSON based REST Web Service in ADF 12.2.1.3

About Ashish Awasthi

Ashish Awasthi
An Oracle ACE, Blogger, Reviewer, Technical Lead working on Oracle ADF

Consuming JSON based REST Web Service in ADF 12.2.1.3

Previously I have posted about consuming ADF BC based REST Web Service in ADF. Now, this post talks about consuming JSON based REST Web Service using generic data control.

You can also look at previous posts on Web Service for more information.

Create SOAP Web Service with Application Module quickly in ADF 12.2.1

Create REST Web Service with Application Module declaratively in ADF 12.2.1

Consuming a SOAP Web Service quickly using Web Service Data Control (WSDL) in ADF

Create POJO based JAX-WS WebService easily with JDeveloper 12.1.3

Populate data in ADF Table using Web Service Data Control

Populate select one choice using Web Service Data Control in ADF Application

Access JAX-WS web service from Java Class using Web Service Proxy in JDeveloper

In this post, I am using a free REST API Web Service to get all countries name. Check below link for detail of Web Service methods.

RESTful web-services to get and search Countries

Let’s see how to implement this in JDeveloper 12.2.1.3

Create a Fusion Web Application with default Model and View Controller projects.

Consuming JSON

Right click on the View Controller project and Select New–> From Gallery–> Business Tier–> Web Services and select Web Service Data Control SOAP/REST 

Consuming JSON

It opens Web Service Data Control creation wizard, Select REST as Web Service type and provide a meaningful name, Generic Data Control with manually described resources as the type of data control.

Consuming JSON

Click on the green plus icon to create new ADF Rest Connection, Enter connection name and URL of the web service.

Here URL of web service is http://services.groupkt.com/country/get/all and I am using http://services.groupkt.com/country/get, /all is left here as it’ll be used later. Select authentication type none and test connection.

Consuming JSON

Click on OK and you can see that REST connection is created. Click on the next button and skip OWSM policies and come to the Resources tab.

Now click on green plus icon and add /all as the resource path, select GET method checkbox and put a name for the method and set JSON as Data Format.

Consuming JSON

Click on Next button and set method payload, Select Parse from Sample Code and access web service from the browser and paste the code in Response Sample.

For this post click on this link to copy the sample response – http://services.groupkt.com/country/get/all

Consuming JSON

Click on Next and Test Rest Connection.

Consuming JSON

On the click of the finish button, a file DataControls.dcx is generated. This is a data control definition file and contains information about data collection nodes and built-in data collection operations.

Consuming JSON

Now consuming web service part is done and next is to create a page and use WSDL to show a table on that page.

Right click on the view controller and select New–> From Gallery–> Web Tier–> JSF/Facelets and create a new page

Consuming JSON

Expand Data Controls section of Fusion Web Application and you can see there a get() method and under it the message and result data collection.

Drop get() method as a button and both collections as the table on the page and run application.

Consuming JSON

Published on Java Code Geeks with permission by Ashish Awasthi, partner at our JCG program. See the original article here: Consuming JSON based REST Web Service in ADF 12.2.1.3

Opinions expressed by Java Code Geeks contributors are their own.

(0 rating, 0 votes)
You need to be a registered member to rate this.
Start the discussion Views Tweet it!
Do you want to know how to develop your skillset to become a Java Rockstar?
Subscribe to our newsletter to start Rocking right now!
To get you started we give you our best selling eBooks for FREE!
1. JPA Mini Book
2. JVM Troubleshooting Guide
3. JUnit Tutorial for Unit Testing
4. Java Annotations Tutorial
5. Java Interview Questions
6. Spring Interview Questions
7. Android UI Design
and many more ....
I agree to the Terms and Privacy Policy

Leave a Reply

avatar

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  Subscribe  
Notify of