We have already seen SOAP web services and RESTful web services in detail before. In this post, we are going to see differences between SOAP and REST web services.
SOAP vs REST web services
SOAP stands for simple object access protocol
REST stands for REpresentational State Transfer
Protocol vs Architectural style
SOAP is a standard protocol to create web services
Rest is architectural style to create web services.
Client and Server are bind with WSDL contract
There is no contract between client and Server.
SOAP supports only XML format
REST web services supports XML, json and plain text etc.
SOAP web services are hard to maintain as if we do any changes in WSDL , we need to create client stub again
REST web services are generally easy to maintain.
Service interfaces vs URI
SOAP uses Service interfaces to expose business logic
Rest uses URI to expose business logic
SOAP has its own security : WS-security
Rest inherits its security from underlying transport layer.
SOAP requires more bandwidth and resources as it uses XML messages to exchange information
REST requires less bandwith and resources. It can use JSON also.
SOAP web services are hard to learn as you need to understand WSDL , client stub
REST web services are easy to understand as you need to annotate plain java class with JAX-RS annotations to use various HTTP methods.