Talking about SOAP webservice and Restful webservice again

I have been in contact with webservice for six years, and it is a powerful tool for dealing with heterogeneous cross-platform data exchange. The specific concept is not explained in detail. There are many blogs about this. Such as: http://blog.sina.com.cn/s/blog_493a845501012566.html
Here we mainly talk about our own experiences and feelings.
1. Protocol structure and format definition:
SOAP + xml Simple Object Access Protocol, with SOAP headers, XSD or Bean annotations can be used to define data
HTTP methods + xml or json, in fact, it can be seen as HTTP headers, which are very important to the transmission data format The requirements are not strict, such as whether the element must, value, type, frequency, etc. are far less than SOAP requirements.
2. Test tool:
SOAPUI
java -jar restclient-ui-3.2.2-jar-with-dependencies.jar
3. Best practice of calling method In
theory , HTTPClient is used to send the content approved by the server, and then the response can be obtained. As long as the protocol is the same and the content format conforms to the definition, all mainstream development languages ​​can recognize and process the request information (http, xml or json) and respond to it. This is the essence of cross-platform.
SOAP best practice, can generate related bean according to wsdl definition, encapsulate data by bean, data serialization and deserialization are more convenient.
Restful, since only the http method is required, it is recommended to use the json type UTF-8 format to directly request the response. There are also many tools for mutual conversion between json and beans, such as Gson,
4. Basic features
SOAP is mature, secure ,
Restful is simple and efficient
5. Application scenarios
Restful is suitable for front-end interaction, and the security is not so high.
SOAP is suitable for mutual calls between component services, and the business is well defined and clear.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326988401&siteId=291194637