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 the Author .::

Java4s_Author
- Full Stack Java/J2EE & UI Web Developer
Founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog, Love Java and UI frameworks.
You can 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.
Most Recent Posts from Top Categories
Hibernate Spring Struts
Contact | About Us | Privacy Policy | Advertise With Us

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