Difference between Web Service (SOAP) and HTTP interface

 

 

What is web service?

 

 

Soap request ( Simple Object Access Protocol, Simple Object Access Protocol ) is a special version of HTTP POST, following a special xml message format Content-type is set to: text/xml Any data can be xml.

 

 

SOAP: Simple Object Access Protocol, Simple Object Access Protocol (SOAP) is a lightweight, simple, XML-based protocol designed to exchange structured and solidified information on the WEB. SOAP can be used in conjunction with many existing Internet protocols and formats, including Hypertext Transfer Protocol (HTTP), Simple Mail Transfer Protocol (SMTP), and Multipurpose Internet Mail Extensions (MIME). It also supports a wide variety of applications ranging from messaging systems to remote procedure calls (RPCs).

 

 

SOAP is an XML-based protocol for exchanging messages, and HTTP can be used to transfer this information. In fact HTTP is the most common transport tool for SOAP messages. After soap serializes the information to XML, it is packaged and transmitted by means of the http protocol. The transmission method is still tcp or udp. It's easy to understand with an analogy. Both tcp and udp are roads. For the time being, consider tcp as general roads, udp highways, soap and http are cars, then soap and http can run on tcp and udp. It is said that soap can be transmitted through http, which means that soap is a car, and http is a truck loaded with cars. The information of soap is loaded into http, and then transported. Of course, the road to take is still tcp or udp. It is not very accurate to say that soap can be transmitted through the http protocol. It is more accurate to say that the soap information can be packaged through the http protocol and then transmitted through tcp or udp.

 

 

 

SOAP consists of four parts:

   SOAP

It defines a framework that describes what is in the message, who should handle it and whether it is optional or required.

  SOAP Encoding Rules: It defines a serialization mechanism for exchanging instances of application-defined data types.

  SOAP RPC representation: It defines a contract for representing remote procedure calls and replies.

  SOAP Binding: Defines a convention for exchanging SOAP wrappers between nodes using the underlying transport protocol.

  SOAP messages are basically one-way transfers from sender to receiver, but they are often combined to implement a request/response-like pattern. All SOAP messages are encoded in XML. A SOAP message is an XML document containing a required SOAP wrapper, an optional SOAP header, and a required SOAP body.

  Binding SOAP to HTTP provides the advantage of taking advantage of both the style and decentralized flexibility of SOAP and the rich feature library of HTTP. Delivering SOAP over HTTP is not to say that SOAP overwrites existing HTTP semantics, but that SOAP over HTTP semantics map naturally to HTTP semantics. Where HTTP is used as the protocol binding, RPC requests map to HTTP requests, and RPC responses map to HTTP responses. However, the use of SOAP over RPC is not limited to HTTP protocol bindings.

  SOAP can also be bound to the TCP and UDP protocols.

 

 

 

 

Why learn web services?

Most external interfaces will implement web service methods instead of http methods. If you don't, there is no way to connect.

 

Are web services better than http (post/get)?

1. The methods and required parameters implemented in the interface are clear at a glance

2. Don't worry about capitalization

3. Don't worry about the Chinese urlencode problem

4. There is no need to declare the authentication (account, password) parameters multiple times in the code

5. The passed parameters can be arrays, objects, etc...

 

Is web service faster than http (post/get)?

There may be some slowdown in speed due to xml parsing.

 

Can web service be replaced by http (post/get)?

It is completely possible, and the current open platforms are implemented using HTTP (post/get).

 

some say

httpservice通过post和get得到你想要的东西
webservice就是使用soap协议得到你想要的东西,相比httpservice能处理些更加复杂的数据类型

当你要调用一个你本服务的内容的时候,不涉及到跨域的问题,你可以使用HttpService的方式。
如果,你需要在后台调用一个其它应用的服务,这个时候,你必须要用webService的方式来调用。

 

 http://blog.csdn.net/tobetheender/article/details/52703726

Guess you like

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