DEV Community

vikash-agrawal
vikash-agrawal

Posted on

3

REST vs SOAP

• REST (REpresentational State Transfer) is an architectural style while SOAP (Simple Object
Access Protocol) is a protocol.
• REST is all about simplicity, where it comes with the lighter data (JSON), although it
supports other format as well, e.g. simple TEXT., HTML, XML etc, while SOAP is built within
the envelop, where it contains data in XML.
• REST comes with SSL security and https while SOAP comes with WS-Security as well.
• SOAP has built in ACID compliance that’s why it makes it favorable choice when it comes
to sensitive data e.g. financial data.
• AS REST is lighter so it needs less bandwidth as compared to SOAP.
• Data can be cached only in REST not in SOAP.
• SOAP has strict communication contract.
• REST uses URL and URI to access the API while SOAP uses service interface (WSDL file) to
expose its functionality to client application.
• If the service is required to maintain the state from one request to another then SOAP is
preferred.
• The WSDL file is a contract between the client and server. The content in this file has all
the information about the services being exposed, which includes field name, field type. If
there is any change to any parameter, it would have the huge impact on all the client side
implementation.
• Using wsimport, you can generate all the classes from wsdl file. Wsdl file is a xml file which
contains the schema. It can be used to create data object including the Authentication
detail and sent it over the network. The signature for the request is similar between rest
based service and soap based service with only difference:

o SOAP Action
o Soapenv
o soapenv: Body

• Status Code:

o 200: Request got executed successfully.
o 201: resource has been created successfully.
o 202: Accept, means the request has been accepted for execution asynchronously.
o 203: Non Authoritative information, means the content has been delivered from 
third party
o 400: Bad request because of syntax error.
o 401: Authentication is needed.
o 403: Authenticated but don't have enough access for the given request.
o 404: Resource not found

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

Top comments (0)

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay