Using SOAP and REST

java, rest, soap, web-services

Solution

1. From the programmer's perspective, is using REST useful at all?

REST is definitely useful. It's a different way of utilizing web services, compared to what you're used to in SOAP. Here's a quick comparison:

In the end, they each serve their own purpose in the service-oriented world. SOAP is mature but bloated. REST is relatively younger, but is a more natural fit with HTTP. It has huge potential, especially when service contract standards are put into place. When WADL matures, it will boost the popularity and adoption of REST.

2. Is there any good framework that will make hitting REST easier?

A lot. Here are some of the known REST frameworks, with the popular ones being JAX-RS, Jersey, RESTEasy and Restlet.

Problem

I have used SOAP service successfully. Suppose there is a Web Service that exposes a method that returns the list of Students. ``` public Student[] listAllStudents(){ //some code that return Student array } ``` Using SOAP will need these steps: - Get the URL for the location of WSDL. eg. `http://127.0.0.1/web/service/location/soap.php?wsdl` - Use some available technologies like axistools-maven-plugin to generate all stub classes. There will be a generated class with the name like Student Use the appropriate stub class/interface to invoke the service. `Student[] students = theStub.list_All_Students();` Using REST service will be something like this. - Get the right url for getting list of Students. eg. `http://127.0.0.1/web/service/student/list?sort=true` - Use some URL Connection techniques like java.net.HttpURLConnection to get the result which is usually in JSON format. - Parse the result. As a Java programmer, I have no problem in using SOAP because there are frameworks designed for it. Moreover, there is only one URL that I need to know for hitting the Web Service. Using REST is a bit confusing. I need to know all the specific URLs along with the query string required to be passed. From this point of view using REST is quite cumbersome. My Questions: - From the programmer's perspective, is using REST useful at all? - Is there any good framework that will make hitting REST easier?

Original source

Related problems