SOAP and REST in brief

SOA architecture is used for the cooperation of heterogeneous systems, so a common message exchange format across operating systems and languages ​​is required. Both SOAP and REST are text-based message bodies, which have cross-platform advantages compared to binary messages, so they are selected as common implementation methods for SOA interfaces. But SOAP and REST have their own different characteristics and uses.
    SOAP: The HTTP protocol is used as the transport layer protocol. The essence is to use HTTP for transmission, and use XML to encapsulate the RPC call of the message content.
REST: REST is not a protocol, but a design specification. The design specification requires the program to comply with the original design of the HTTP protocol, and use HTTP GET/PUT/DELTET/POST to operate on resources. The REST interface is based on URI resources. Basic, an interface for CRUD operations on resources.
Comparison of SOAP and REST:
  • SOAP is more heavyweight than REST. Due to the use of XML-formatted message bodies, the payload of the message is less than that of JSON, which is commonly used in REST. However, the advantage of XML messages is that they are easier to read than JSON.
  • The SOAP interface is self-explanatory, described by WSDL, and the program can be interpreted based on WSDL and automatically generate the SOAP calling code; the REST interface can only be described by the interface document, and it is difficult to interpret the interface definition by the program.
  • SOAP uses HTTP as the transport layer protocol, and the service call is transparent to the HTTP protocol. It is difficult to control the fine-grained authority of SOAP on the firewall, and it is also difficult to use the caching mechanism of HTTP to improve the efficiency. REST is a standard HTTP access, which can make full use of some benefits provided by the HTTP protocol, such as better permission control on the firewall (the minimum granularity can be based on the CRUD operation of each URL), and can also make full use of the cache to improve the response speed. and system throughput efficiency.
  • Since REST is a standard HTTP access, its applicability is wider, and both web applications and mobile applications can easily use the REST interface to construct applications without using third-party libraries.
  • For mobile programs, because REST's payload ratio is higher than SOAP's XML encapsulation, using REST interface can reduce the bandwidth used by the program.
  • According to the REST design principle, the interface is stateless, so the service capability can be improved simply by extending the server horizontally.
For WEB Service, SOAP and REST have their own advantages. SOAP has complete standard specifications and automated development tools, while REST is simpler and more friendly to mobile applications. Oracle SOA Suite provides a quick way to convert SOAP to REST interface. It can provide REST form encapsulation for existing SOAP interface, and provide both SOAP and REST interface for web service. It is a complete solution that integrates the advantages of various aspects. .

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324736693&siteId=291194637