Nowadays, as the development of the internet, web services are also development rapidly in order to meet the demanding need of the user. Web services have changed dramatically from architecture, usage, method and concept. There is a tendency that web services are moving away from SOAP-based towards RESTful. A basic comparison and discussion between SOAP and RESTful will be shown in this article.
What is web service?
Web services are a form of distributed information system. Typically speaking, it is application interface based on a network to fulfill the task of interaction and communication. The services are usually described in a standardized format such as WSDL and can be accessed via HTTP on a remote machine. Web services are tending to group into two categories: Big Web Services and RESTful Web Services.[1]
What is SOAP? How it is used in web service?
SOAP (Simple Object Access protocol) is a typical protocol in Big Web Services category because SOAP message are usually delivered using an XML format and via HTTP. SOAP also combines many other web-based standards.
What is RESTful web service?
RESTful web service stands for Representation State Transfer. It is a style of software architecture described by Fielding. The REST architectural style was developed in parallel with the HTTP/1.1 protocol, based on the existing design of HTTP/1.0.[2]
In a RESTful web service, there are two types of parties: clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. The key momentum of RESTful is representation. All the resource transferring through requests and response are addressed in a represented way. They can be coherent and meaning concept captured by a document with a state.
There are states for the client party: application states and “at rest”. A client in a rest state is ready to interact with its user. During this state, any interaction does not occupy any storage of the servers or have no load on the network.
Each interaction or request for the user provides the client with the opportunity to change the state of the object by navigating to a different URI (Uniform Resource Identifier). The application of transferring state and also URI will be represented and maybe used when the client asks for a transmission next time.The following figure shows a work flow of a REST-style work flow:
[5]
Initially, RESTful web service is developed based on HTTP and can be called using some HTTP method such as PUT, POST and GET; but it can be used by other application layer protocols if the protocol can have a uniformly representation method which can give a meaningful solution of each document.
To conclude, REST has four major factors: resource identification through URI, uniform interface, self-descriptive messages and stateful interactions through hyperlinks.[4]
Comparison between SOAP-based web service and RESTful web service
There many discussions on SOAP and REST technology. From the architectural principle of the two services, they are different from:
1. Layering: SOAP is using HTTP as transport-layer protocol while REST treats HTTP as application-level protocol.
2. Compatibility: SOAP has advantages on computing the middleware while REST is simple and able to apply even on a browser.
3. Scalability: SOAP is based on WSDL and XML while REST supports a uniform interface as well as XML.
For detailed characteristic comparison, please refer to the appendix.
Furthermore, they have their own advantages on different aspects.
Advantages of SOAP:
1. SOAP is protocol transparency and independence. The same message in the same format can be transported and accepted by many tyeps of working system rely on HTTP.2. Quality of service such as encryption and reliable transfer can be made using SOAP independently from the transport path.
3. Using WSDL in SOAP has many advantages on compatibility with working platform (both operating system and programming language).
4. SOAP engines and WSDL tools are well-developed which can effectively help integrator to develop a interpretational service on a sophisticated and complex application without carefully knowing all the functions of the application. For example, test clients can be generated from the WSDL contracts automatically.
Advantage of RESTful
1. RESTfulWeb services are perceived to be simple because REST leverages existing well-known W3C/IETF standards (HTTP, XML, URI, MIME). It is uniformed so that the meaning of the document is easily known between parties.2. RESTful has a lightweight infrastructure is inexpensive to acquire so that it has a very low barrier for adoption. For example, developers can begin testing RESTful to client services from an ordinary Web browser, without having to develop custom client-side software.
3. REST is scalable and easier for users to discover the web resource based URI and hyperlinks. RESTfulWeb service is stateless so that it is able to serve a very large number of clients with the support for caching, clustering and load balancing built into REST.
Conclusion
Since there are so many trade-offs between SOAP and RESTful technology, it remains a problem for the users in choosing the method of web service. As the tendency of increasing number of users and web services, it is a problem to be considered. The characteristic of scalability of the service may be the most important point to consider. RESTful web service needs to be consummate before it is widely applied in the future.
References:
[4] RESTful Web Services vs. “Big” Web Services: Making the Right Architectural Decision by Cesare Pautasso, Olaf Zimmermann, Frank Leymann
[5] Developing web services choreography standards—the case of REST vs. SOAP by Michael zur Muehlena,*, Jeffrey V. Nickersona, Keith D. Swensonb
[6] A RESTful Web service, an example by Paul James on Thu 11th Nov 2010
Appendix:
The detailed characteristics of SOAP and REST[5]


没有评论:
发表评论