What is a web Service
It is a service based on the HTTP protocol, the user sends the HTTP request data on the server, the server will also put the data in the HTTP response returned to the requestor.
Web service requests consist mainly of two parts, one is the method information, the other is the scope information, which is the key factor to differentiate the Web service.
Method information
The method information is used to describe what action to take on the data, such as whether it is created or deleted, whether it is an update or a fetch. Specifically, there are two ways:
The first is to put the method information in the HTTP method, this service is restful; for example, get the data with HTTP GET, delete means delete data,
Put represents updating data. This approach maximizes the use of the HTTP feature itself.
Another way is to put the method information in the entity body (that is, HTTP newspaper style) or HTTP message header, the typical example is a SOAP-type web Service.
As an example, suppose you want to get the people information on a www.somewebsite.com, a restful way may be, the style of the newspaper is empty
GET people/http/1.1
HOST:www.somewebsite.com
...
The way soap might be, the get tag inside of it indicates the method information
post/http/1.1
Host:www.somewebsite.com
Content-type:applicatin/soap+xml
...
<?xml version= "1.0" encoding= "UTF-8"?>
<soap:envelope xmlns:soap= "http://schemas.xmlsoap.org/soap/envelope/" >
<soap:body>
<get>
<q>people</p>
</get>
</soap:body>
</soap:Envelope>
Scope information
Scope information is used to describe what data to take action, such as stock data or weather data, whether it is today's stock data or the stock data for the entire month.
A restful architecture places the scope information in the URI address, as in the URI of the first example people;
Another option, as shown in the soap example, is to place the scope people inside the message and label it.
Introduction to Web Service (RESTful Web Services chapter I notes)