function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ranu Jain SFDCRanu Jain SFDC 

Diff b/w soap and rest

Anybody let me know when to use rest api and when to use soap? Please reply in in simple language with example/application.
kiranmutturukiranmutturu
REST

The RESTful Web services are completely stateless. This can be tested by restarting the server and checking if the interactions are able to survive.
Restful services provide a good caching infrastructure over HTTP GET method (for most servers). 
This can improve the performance, if the data the Web service returns is not altered frequently and not dynamic in nature.
The service producer and service consumer need to have a common understanding of the context as well as the content being passed along as there is no standard set of rules to describe the REST Web services interface.
REST is particularly useful for restricted-profile devices such as mobile and PDAs for which the overhead of additional parameters like headers and other SOAP elements are less.
REST services are easy to integrate with the existing websites and are exposed with XML so the HTML pages can consume the same with ease. There is hardly any need to refactor the existing website architecture. 
This makes developers more productive and comfortable as they will not have to rewrite everything from scratch and just need to add on the existing functionality.
REST-based implementation is simple compared to SOAP.

SOAP

The Web Services Description Language (WSDL) contains and describes the common set of rules to define 
the messages, bindings, operations and location of the Web service. 
WSDL is a sort of formal contract to define the interface that the Web service offers.
SOAP requires less plumbing code than REST services design, (i.e., transactions, security, coordination, addressing, trust, etc.) Most real-world applications are not simple and support complex operations, 
which require conversational state and contextual information to be maintained. With the SOAP approach, 
developers need not worry about writing this plumbing code into the application layer themselves.
SOAP Web services (such as JAX-WS) are useful in handling asynchronous processing and invocation.
SOAP supports several protocols and technologies, including WSDL, XSDs, SOAP, WS-Addressing

MagulanDuraipandianMagulanDuraipandian
http://www.infallibletechie.com/2014/03/blog-post.html

Check this!!!

If this solves your problem, kindly mark it as the best answer.
Hit Like, if it saved your work :-)

Regards,
Magulan
http://www.infallibletechie.com