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:
http://127.0.0.1/web/service/location/soap.php?wsdl
Use the appropriate stub class/interface to invoke the service.
Student[] students = theStub.list_All_Students();
Using REST service will be something like this.
http://127.0.0.1/web/service/student/list?sort=true
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:
SOAP cannot make use of REST since SOAP is a protocol and REST is an architectural pattern.
A general rule of thumb when you're deciding between SOAP and REST for building your API: if you want standardization and enhanced security, use SOAP. If you want flexibility and efficiency, use REST. For specific use cases of when to use SOAP vs REST, check out the table below.
A REST API can actually utilize the SOAP protocol, just like it can use HTTP.
SOAP uses only XML for exchanging information in its message format whereas REST is not restricted to XML and its the choice of implementer which Media-Type to use like XML, JSON, Plain-text. Moreover, REST can use SOAP protocol but SOAP cannot use REST.
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.
A lot. Here are some of the known REST frameworks, with the popular ones being JAX-RS, Jersey, RESTEasy and Restlet.
This is quite an open ended question, but REST is much more interoperable, not to mention the sheer amount of metadata in each query makes it hardly light weight. Consider if you had to query a SOAP endpoint in javascript, or even php can be a pain in the ass. SOAP uses a contract first mechanism that's really suited when you want to consume it using something like c#.
On your second question, yes, you can parse the RESTful response with either Jackson (only for JSON), RestController in Spring, or JAX-RS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With