Difference between SOAP and RESTful Web Service in Java
Difference between SOAP and RESTful Web Service is one of the frequently asked interview questions in Java. Here is a detailed comparison between them.
|REST (REpresentational State Transfer) is an architectural style on which RESTFul web services are built.||SOAP (Simple Object Access Protocol) is a protocol.|
|JAX-RS is the specification defined for developing RESTful web services||JAX-WS is the specification defined for developing SOAP web services.|
|REST permits different data format such as Plain text, HTML, XML, JSON etc.||SOAP permits XML data format only, actual response is bundled inside a SOAP message which is always in XML format.|
|RESTful Web services are heavily dependent upon HTTP protocol.||SOAP messages can be sent over to any transport mechanism e.g. TCP, FTP, SMTP or any other protocol.|
|Processing a RESTful web service request is much faster because REST serves JSON that is faster to parse than XML||Processing a SOAP request is slower because of the overhead in parsing XML markup|
|RESTful web service takes full advantage of the web caching mechanism||SOAP web services totally ignore web caching mechanism.|
|REST is a concept that does not tie with any protocols. SOAP based web services can be implemented in RESTful style||SOAP can’t use REST architecture.|
|URL typically references the resource being accessed/deleted/updated||SOAP uses XML messages to identify the desired web procedure or resource to be invoked.|
|REST is lightweight as compared to SOAP, it doesn’t require CPU consuming XML parsing||SOAP is heavyweight compared to REST because it requires XML parsing and require a SOAP header for every message.|
|No built-in error handling||Built-in error handling (SOAP faults)|
|Security in RESTful web service can be implemented using standard and traditional authentication methods||SOAP defines own security mechanism|
|Not suitable for distributed computing environment||Designed to handle distributed computing environments|
Hope you find this post useful. If you have any comments, post it in the comments section.
The following two tabs change content below.
Working as a Java developer since 2010. Passionate about programming in Java. I am a part time blogger.
Latest posts by Uday (see all)
- How to run shell commands using SSH connection in Java - July 26, 2017
- Java program to print rectangle of stars - July 20, 2017
- Introduction to Java Enum data type with example programs - March 31, 2017