Monday, November 23, 2015

Call Restful Web Service from JAVA programmatically

In my previous post I have shown how you can create a Restful web service, in this post I will show how you can call this web service programmatically.

Before start you should download the sample web service from here and run the web service.

Follow These Steps to call the web service:

1- From JDeveloper create new custom application



For example, Application Name: CallRestfullWSProgrammatically

2- In this application create new class




For example, Class Name : CallRestfulWS.java

3- In the project properties add 2 libraries

- jersey-client-1.18.jar
- jersey-core-1.18.jar

You can get these jar files from the uploaded sample application



4- Write this code for the main method





5- Run the main method (Right Click ---> Run)




Download the sample application (done using JDev 11.1.2.4.0) from here


No comments:

Post a Comment