- Hands-On RESTful Web Services with Go
- Naren Yellavula
- 246字
- 2021-06-24 17:04:21
Types of web services
There are many types of web services that have evolved over time. Some of the more prominent ones are as follows:
- Simple Object Access Protocol (SOAP)
- Universal Description, Discovery, and Integration (UDDI)
- Web Services Description Language (WSDL)
- Representational State Transfer (REST)
Out of these, SOAP became popular in the early 2000s, when XML riding on a high wave. The XML data format is used by various distributed systems to communicate with each other.
A SOAP request usually consists of these three basic components:
- The envelope
- The header
- The body
Just to perform an HTTP request and response cycle, we have to attach a lot of additional data in SOAP. A sample SOAP request to a fictional book server, www.example.org, looks like this:
POST /Books HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 299
SOAPAction: "https://www.w3.org/2003/05/soap-envelope"
<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:m="https://www.example.org">
<soap:Header>
</soap:Header>
<soap:Body>
<m:GetBook>
<m:BookName>Alice in the wonderland</m:BookName>
</m:GetBook>
</soap:Body>
</soap:Envelope>
This is a standard example of a SOAP request for getting book data. If we observe carefully, it is in XML format, with special tags specifying the envelope and body. Since XML works by defining a lot of namespaces, the response gets bulky.
The main drawback of SOAP is that it is too complex for implementing web services and is a heavyweight framework. A SOAP HTTP request can get very bulky and can cause bandwidth wastage. The experts looked for a simple alternative, and in came REST. In the next section, we will briefly discuss REST.
- TypeScript入門與實(shí)戰(zhàn)
- Three.js開發(fā)指南:基于WebGL和HTML5在網(wǎng)頁上渲染3D圖形和動(dòng)畫(原書第3版)
- 硅谷Python工程師面試指南:數(shù)據(jù)結(jié)構(gòu)、算法與系統(tǒng)設(shè)計(jì)
- SQL基礎(chǔ)教程(第2版)
- Visual Basic程序設(shè)計(jì)教程
- D3.js By Example
- Mobile Device Exploitation Cookbook
- 零基礎(chǔ)學(xué)C語言(升級(jí)版)
- Deep Learning for Natural Language Processing
- 游戲設(shè)計(jì)的底層邏輯
- Android熱門應(yīng)用開發(fā)詳解
- Leaflet.js Essentials
- Python程序設(shè)計(jì):基礎(chǔ)與實(shí)踐
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)
- Python GUI設(shè)計(jì)tkinter菜鳥編程(增強(qiáng)版)