in order to illustrate this problem, we must correct the HTTP know .
First, look at the OSI seven-layer model
The OSI (open System interconnection, open systems interconnect) seven-tier model
7 Application Layer
6 Presentation Layer
5 Session Layer
4 Transport Layer
3 Network Layer
2 Data Link Layer
1 Physical Layer
HTTP is not a transport protocol (layer fourth), but rather a "Transfer Protocol" (top level) of the application layer.
The webservice of SOAP type is the best example, and the SOAP message is simply hosting the HTTP protocol as a message.
So that the various parameters in the HTTP protocol (such as encoding, error code, etc.) are disregard.
In fact, it has a very rich semantics, the HTTP protocol abstract Get,post,put,delete is like the database of the most basic additions and deletions, and the Internet is a variety of resources like records in the database.
RESTful WebService
Rest (representional State transfer)
The popularity and success of the web in the world-wide category, people from a technical point of view of it, both-distributed architecture, attention is focused on architectural style-architectural style.
is a new way of thinking about web development, The idea of resource operation based on HTTP protocol is to design the architecture of the system based on URI.
Then it features mainly by the following five points
1. Resource-oriented (resource)
2. Each resource corresponds to a unique URI Uniform Resource Identifier
3. Operation of abstract resources, using common connection interface to manipulate resources (generic connector interface)
4. The operation of the resource does not change the URI
5. All operations stateless (stateless)
It can be seen that the operation of the rest Abstract resource coincides with HTTP, which interprets the design intent of the HTTP protocol.
SOAP/WSDL WebService
In order to package RPC (Remote Procedure Call) request information, XML-RPC is introduced, but XML-RPC can only use a limited number of data types and some simple data structures.
And then there was soap.
SOAP (Simple Object Access Protocol) is an XML-based structured data exchange. Soap can be used with a variety of transport protocol bindings (binding), such as Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), and Multipurpose Internet Mail Expansion Protocol (MIME) to exchange information using the underlying protocol, such as HTTP.
In theory, soap is a piece of XML that you can send via HTTP,SMTP (copy it to a floppy disk and send it to a courier company).
The relationship between SOAP and HTTP
SOAP is based on the HTTP protocol, an XML-based protocol. That is, HTTP + XML = soap, or SOAP, is an HTTP request/response that follows the SOAP encoding rules.
Wsdl
WSDL is a description language based on SOAP communication, and WSDL is used to describe soap, which is also a section of XML.
So, we can compare their merits and demerits from the following aspects.
1. Maturity, specification
SOAP is more mature than rest, specification, supported by a lot of vendors, REST just provides ideas, so we are still in a fighting each other situation.
2. Flexibility
REST is the implementation of resource operation based on HTTP protocol, which greatly reduces the complexity and scalability of development.
3. Efficiency, Ease of use
SOAP expands the content of the protocol on demand, resulting in decreased processing performance and increased learning costs. Rest uses ROA (resource-oriented Architecture, resource-oriented architecture) to design and fuse WEB2.0 front-end technology to improve development efficiency.
4. Security
SOAP uses the xml-security and xml-signature two specifications to form the ws-security for security control, and REST does not currently have any description.