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?