SOAP It is a specific communication protocol, and REST is a specification.
2,
[html] strong> view plain copy
SOAP(SimpleObject Access Protocol) Simple Object Access Protocol is a heterogeneous system communication protocol based on HTTP. To put it bluntly, it is the transmission of xml documents. The reason why there is it is to communicate with systems developed in different languages such as C, C++, JAVA, etc. , WebService is based on the SOAP protocol, it is indeed a more traditional SOA solution.
< span style="margin:0px; padding:0px; border:none; color:black; background-color:inherit">REST (Rerepresentational State Transfer) is an architectural style proposed by a foreign doctor, from the perspective of resource state transition Regarding our resources (so concise and clear), foreigners are quite good, but they also communicate based on the SOAP protocol. This is his paper:
not SOAP can be developed with cxf, SOAP is just a protocol standard, you also develop What?
As for WebService development frameworks, there are also many, the more popular ones are cxf, axis, axis2, etc. You can see it at a glance on Apache. It’s just convenient for us to develop. It can be developed with jdk, but they encapsulate jdk, which saves us trouble.
rest is a style. The difference between restful Webservice and soap is that the form of expression is different. If you want to learn more, you can open it and understand Webservice in depth. In this book, restful Webservice can not only use json, but also xml, but also use html as message return, restful Webservice and traditional soap The main performance is that rest exposes resources and soap is an exposure operation. For getting started, please see http://www.infoq.com/cn/articles/rest-introduction. Cxf also provides restful-style Webservice. The specific process is actually and The soap is the same, but the rest is more convenient and lighter, it can’t be said specifically. There are too many things. You need to read it by yourself.
4,
[html] view plain copy
SOAP is more complex, based on XML, and has corresponding specifications; REST uses HTTP request methods GET, POST, PUT to agree on transaction operations. Simply put, SOAP defines the specific data of the request and response, the operation to be performed, etc. through the transmission of XML, and REST is another convention, such as requesting the RUL of /user/1001, and the GET method returns an id of 1001. The POST method is to update the user information with an id of 1001, delete the user information, and so on.
< p style="color:rgb(51,51,51); font-family:Arial; font-size:14px">
5、< /p>
[h tml] view plain copy
div>
Two ways SOAP for WebService Compared with REST (transfer)
My thoughts after reading: Since I first came into contact with WebService, I didn’t understand many concepts, especially when I saw the differences between OpenAPIs When it comes to providing the method, I am even more confused. For example, google map api adopts AJAX method and provides API through javascript, while Taobao TOP adopts direct HTTP+XML request method. What puzzles me most is the WSDL mentioned in the textbook. UDDI has never appeared in these APIs. Now I know that WebService originally has two methods, one is the SOAP protocol method, in which WSDL, UDDI, etc. are required, and the other is the REST method, which does not require WSDL, UDDI, etc. at all. And the REST approach now seems to be a more popular and promising approach.
WebService occupies a very important position in the basic technology implementation of SOA. Usually we mentioned that the first idea of WebService is SOAP message Interact on various transmission protocols. In recent years, the idea of REST has been gradually accepted by everyone along with SOA. At the same time, major websites continue to open APIs to developers, which has also stimulated the upsurge of REST-style WebService.
Before receiving the new demand email, my understanding of REST was only by reading Dr. Fielding’s REST if I didn’t understand The thesis, to be honest, I wanted to understand such a new concept at the time, and I only had a superficial understanding of its internal thinking.
The latest requirement of ASF is that it may need to implement REST-style WebService integration, so I have to take a good look at the true meaning of REST And the current design methods of major websites. What I want to express later is also some of my beginner’s views and opinions, and I hope I can get more feedback and opinions before I integrate REST into ASF.
SOAP
What is SOAP? I don’t think I need to say any more. Google is full of eyes. In fact, SOAP was originally a solution to RPC, a simple object access protocol, very lightweight, and as an application protocol, it can deliver messages based on multiple transport protocols (Http, SMTP, etc.). However, with the widespread application of SOAP as a WebService, additional content is constantly added, making developers feel that SOAP is heavy and the threshold for use is high. In the follow-up development process of SOAP, the formulation of a series of WS-* protocols has increased the maturity of SOAP and also increased the burden on SOAP.
REST
REST is actually not a protocol or a standard, but an interpretation of the original intention of the Http protocol. Today, when the Http protocol is widely used, more and more As a transmission protocol, rather than an application protocol considered by the original designer. The SOAP type WebService is the best example. The SOAP message uses the Http protocol as the message carrier, so that various parameters (such as encoding, error code, etc.) in the Http protocol are ignored. In fact, the most lightweight application protocol is the Http protocol. The get, post, put, and delete abstracted by the Http protocol are like the most basic additions, deletions, and changes in the database, and various resources on the Internet are like records in the database (maybe this metaphor is not very good), for various resources Operations can always be abstracted into these four basic operations in the end. After the rules for locating resources are defined, operations on resources can be implemented through the standard Http protocol, and developers will also benefit from this lightweight protocol.
I understand the REST thoughts and summarize the following key points:
1. Resource-oriented interface design
All interface designs are designed for resources, which is very similar to our object-oriented and The difference in process-oriented design is that all operating entities on the network are now regarded as resources. At the same time, the design of URI also reflects the positioning design of resources. It will be mentioned later that the API design of some websites is said to be REST design, but it is actually a hybrid of RPC-REST, not the idea of REST.
2. CRUD based on abstract operations
This is very simple. The get, put, post, and delete in Http correspond to read and update respectively. , create, delete four operations, if only as operations on resources, abstraction becomes these four is enough, but for some current complex business service interface design, such abstraction may not be able to satisfy. In fact, this also exposed such a problem in the API design of the following websites. If you want to design completely according to the REST idea, then the applicable environment will be limited, rather than universal.
3. Http is an application protocol, not a transmission protocol
This point is clearly reflected in the API analysis of major websites later, in fact, some The website has gone the old way of SOAP. It is said that it is a REST concept design, but it is actually a set of private SOAP protocol, so it is called a REST-style custom SOAP protocol.
4. Stateless, self-contained
This is actually not only for REST, as an interface design needs to be able to do this , Is also the most basic guarantee of scalability and efficiency, even if it uses SOAP WebService.
REST vs SOAP
Maturity:
Although SOAP has been developed so far that it has deviated from its original intention, the release and invocation of services in heterogeneous environments and the support of vendors have reached a relatively mature situation. Web services that interact through SOAP between different platforms and development languages can communicate better (in terms of some complex and special parameters and returned object analysis, the agreement does not make very detailed regulations, which leads to some amendments) < /span>
https://Amazon FPS web service end point/?AWSAccessKeyId=Your< span style="margin:0px; padding:0px; border:none; background-color:inherit"> AWSAccessKeyId
&Timestamp=[Current timestamp] &Signature=[Signature calculated from hash of Action and Timestamp]
&SignatureVersion=[Signature calculated from hash of Action and Timestamp]
&Version=[Version of the WSDL specified in YYYY-MM-DD format] &Action=[Name of the API]
¶meter1=[Value of the API parameter1] ¶meter2=[Value of the API parameter2]