Please disable your adblock and script blockers to view this page

Search this blog

Showing posts with label Consuming Web Services. Show all posts
Showing posts with label Consuming Web Services. Show all posts

Tuesday 8 January 2019

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' names. Check the 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.



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



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.



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.



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

Now click on the 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.



Click on the 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



Click on Next and Test Rest Connection.



With 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.



Now consuming web service part is done and the 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



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.



All done :)

Sample ADF Application (Jdev 12.2.1.3) - Download

Cheers 🙂 Happy Learning

Wednesday 26 December 2018

Consume ADF BC based REST Web Service using ADF REST Data Control

Creating and consuming web service is an important part of the development cycle in any technology. Here in this post, I am going to show that how can we consume ADF BC based REST web service in an ADF application. In ADF 12.2.1 release Oracle provides support for declaratively consuming REST Web Service, Before that it was only possible using java and that was a tedious task for fusion developers.

Suppose I have an ADF BC (Business Components) based REST web service that returns a list of Departments. Now to consume that web service we'll use ADF REST Data control. Here I am going to illustrate this step by step.

I am using JDeveloper 12.2.1.3, Let's start with Creating a Fusion Web Application with model and view controller project.



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



It opens Web Service Data Control creation wizard, Select REST as Web Service type and provide a meaningful name, Select Describe-Based ADF Data Control as the type of data control.



Click on the green plus icon to create new ADF Rest Connection, Enter connection name and URL of the web service.
Here you should know that URL of ADF based REST web service typically has a host, port, context root path with version name, resource name. So URL of my web service is this

http://127.0.0.1:7101/RestWebServApp-RESTWebService-context-root/rest/Jdev12.2.1/Department

and to make it REST Describe URI just add describe after resource name and put that URL in URL Endpoint field

http://127.0.0.1:7101/RestWebServApp-RESTWebService-context-root/rest/Jdev12.2.1/Department/describe

Default authentication type is none so leave it and test the connection.



Click on OK and you can see that REST connection is created.



Click on next button and come to Select Resources tab and add resources to the selected side.



On the Finish tab test REST connection once again and you can see It is successful.



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.



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



Expand Data Controls section of Fusion Web Application and you can see there Departments data collection node. On expanding it you can see the attributes of the Departments table and its operation.



Select Departments from data control and drop it on the page as ADF table, Also dropped Previous and Next operation as a button on the page.



Now run and check application, Data is populated from the web service using ADF REST data control



Click on Next button to navigate between rows



All done 🙂 

This is how you can consume an ADF BC based REST WebService in Fusion Application. 

Saturday 3 June 2017

Access JAX-WS WebService from Java Class using Web Service Proxy in Jdeveloper


Web Service proxy class is a way to communicate with XML-based WebService using SOAP format,
In short, we can use service proxy class at client to access WebService

In JDeveloper IDE we can easily create client proxy class for WebService, Here in this post I am creating client proxy class to access a JAX-WS web service that I have created in previous blog post

Create POJO based JAX-WS WebService easily with Jdeveloper 12.1.3

Let's see how to implement this


Monday 22 May 2017

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


My previous post was about creating a JAX-WS Web Service from Java Bean and consuming web service and showing data in ADF table. Now In this post, I am going to elaborate about consuming that Web Service in ADF Application and show Employees data in selectOneChoice component


So for this requirement, We need to use Web Service Data Control and from that WSDL we can create ADF Faces components

Let's see how to implement this

Thursday 18 May 2017

Populate data in ADF Table using Web Service Data Control


My previous post was about creating a JAX-WS Web Service from Java Bean. Now In this post, I am going to elaborate about consuming that Web Service in ADF Application and show Employees data in ADF Table

So for this requirement, We need to use Web Service Data Control and from that WSDL we can create ADF Faces components

Let's see how to implement this

Thursday 14 January 2016

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

Creating and Consuming Web Servie is an important part development cycle . In earlier posts i have described about creating SOAP/REST Web Service
Create REST Web Service with Application Module declaratively in ADF 12.2.1
Create SOAP Web Service with Application Module quickly in ADF 12.2.1

Now this post is about consuming a SOAP Web Service. A very simple way to consume Web Service is to create Web Service Data Control (WSDL) for external Web Service URL
Here i am using a Country-Currency Web Service (http://www.webservicex.net/country.asmx) to create WSDL