Get all updates of Java4s
Follow Us: Email Newsletter

How to Test (JAX-RS) RESTful Web Services

Web Services » On Jul 20, 2014 { 1 Comment } By Sivateja

In this article i will show you how to test RESTful web service (JAX-RS), so far we have learned how to create a RESTful service and testing GET and POST requests through some web browser.  But in real time projects we will use different tools to test RESTful web services.  If you would like to test JAX-RS with web browser you can use the following tools…

  • Postman [ Chrome Extension ]
  • REST Client [ Chrome Extension ]
  • Advanced REST Client [ Chrome Extension ]
  • Rest Client [ Firefox Add-On ]

If you would like to test JAX-RS in your local

  • RESTClient UI
  • SoupUi

In this tutorial i will show you how to test jax-rs with RESTClient UI

  • Click here to Download RESTClient UI
  • Open the above link and download restclient-ui-3.2.2-jar-with-dependencies.jar
  • We are done, you no need to do any configurations kind of things, Just double click on the downloaded jar file to run the application, it looks like…

Lets take an example with GET, POST, PUT, DELETE for testing the web service.

Required Files

  • pom.xml
  • web.xml
  • TestingRestfulWebService.java

pom.xml

web.xml

TestingRestfulWebService.java

Testing JAX-RS GET Request

  • Eclipse > Run the application > Now open Restclient UI
  • In the URL field enter  http://localhost:2013/TestRestfulWebServiceExample/rest/customers/100
  • Choose GET method in the ‘HTTP Method’ options > now hit the start button and check the output
  • Output

Testing JAX-RS POST Request

  • Choose POST method in the ‘HTTP Method’ options > Hit the start button and check the output
  • Output

Testing JAX-RS PUT Request

  • Choose PUT method in the ‘HTTP Method’ options > Hit the start button and check the output
  • Output

Testing JAX-RS DELETE Request

  • Choose DELETE method in the ‘HTTP Method’ options > Hit the start button and check the output
  • Output

You Might Also Like

  ♦ About Author ♦

Java4s_Author
sivateja@java4s.com
Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

One Response to “How to Test (JAX-RS) RESTful Web Services”
  1. rani says:

    Hello Sivateja,

    I have a real time scenario that i want to retrieve a merchant information from the list of merchants stored in db searching by business name first and if not found we should search by combination of fields, for ex,
    business name+phone number;
    business name+City;
    phone number+city+state; etc

    If you have an idea about this scenario using RESTFUL WEB SERVICES USING JERCY

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs
Most Recent Tutorials
Hibernate_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
Upcoming
  Web Services [ SOAP ], JSP
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.