Introduction to Web Service (RESTful Web Services chapter I notes)

Source: Internet
Author: User
Tags soap

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)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.