SOAP协议和HTTP协议有什么区别?当我们说“SOAP over HTTP”时,这是什么意思?
--------- HTTP portion of the message ------
POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
--------- SOAP portion of the message ------
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPrice>
<m:StockName>IBM</m:StockName>
</m:GetStockPrice>
</soap:Body>
</soap:Envelope>
以下是更多阅读材料:
SOAP代表简单对象访问协议。它基于XML用于发送和接收消息。它在XML中定义。
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.example/2003/05/soap-envelope/"
soap:encodingStyle="http://www.example.com/2003/05/soap-encoding">
<soap:Body>
<m:GetPriceResponse xmlns:m="http://www.example.com/prices">
<m:Price>1.90</m:Price>
</m:GetPriceResponse>
</soap:Body>
</soap:Envelope>
SMTP代表简单邮件传输协议。简单邮件传输协议是一种可靠和高效地传输电子邮件的方式。SMTP用于向收件人的邮箱发送邮件,从而使用各种方法访问他的邮箱中的电子邮件。SMTP默认使用TCP端口25。邮件提交的协议相同,但使用端口587。由[SSL]保护的SMTPS连接,默认使用端口465(非标准,但有时出于遗留原因使用)。我们可以同步或异步地发送消息。会话可以自动管理。
SOAP是语言相关的,但SMTP是语言无关的。 SOAP主要用于XML Web服务。SMTP也使用http协议来获取或发布信息。