简体   繁体   English

SOAP和HTTP协议之间的区别?

[英]Difference between SOAP and HTTP protocol?

What is the difference between the SOAP and HTTP protocol. SOAP和HTTP协议之间有什么区别。 When we say "SOAP over HTTP", what does that mean.? 当我们说“SOAP over HTTP”时,这是什么意思。

You can serve any content over HTTP such as HTML, images, sound, video, etc. SOAP is an XML-based encoding of messages that are typically sent over HTTP, but could be sent over SMTP or even FTP, although I've never seen such a system used in a production environment. 您可以通过HTTP提供任何内容,例如HTML,图像,声音,视频等.SOAP是基于XML的消息编码,通常通过HTTP发送,但可以通过SMTP甚至FTP发送,尽管我从来没有看到在生产环境中使用的这种系统。

Just like HTTP sits on top of TCP/IP, SOAP sits on top of HTTP. 就像HTTP位于TCP / IP之上一样,SOAP位于HTTP之上。 Layers on top of layers... 层顶层...

If you look at a SOAP request, you can see both layers, with the HTTP headers at the top, followed by the SOAP message. 如果查看SOAP请求,可以看到两个层,顶部是HTTP标头,后面是SOAP消息。 From the w3schools SOAP tutorial : 来自w3schools SOAP教程

---------  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>

More reading for you: 更多阅读材料:

To interact with server, request should be in XML encoded format using SOAP. 要与服务器交互,请求应使用SOAP以XML编码格式。 But in case of HTTP, request can be sent in HTML, Image, video format etc. SOAP request are sent using HTTP protocol. 但是在HTTP的情况下,请求可以以HTML,图像,视频格式等发送.SOAP请求使用HTTP协议发送。

SOAP stands for Simple Object Access protocol. SOAP代表简单对象访问协议。 It is XML based used for sending and receiving messages. 它基于XML,用于发送和接收消息。 It is defined with in XML. 它以XML格式定义。

Example. 例。

<?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> 

stands for Simple Mail Transfer Protocol. 代表简单邮件传输协议。 Simple Mail Transfer Protocol is a way to transfer email reliably and efficiently. 简单邮件传输协议是一种可靠,高效地传输电子邮件的方法。 is used to send mail to the recipient's mailbox,thus using various methods to access the emails in his mailbox. 用于将邮件发送到收件人的邮箱,因此使用各种方法访问其邮箱中的电子邮件。 by default uses port 25. The protocol for mail submission is the same, but uses port 587. connections secured by [SSL], known as , default to port 465 (nonstandard, but sometimes used for legacy reasons). 默认使用端口25.邮件提交的协议是相同的,但使用端口587.由[SSL]保护的连接,称为 ,默认为端口465(非标准,但有时用于遗留原因)。 We can send messages synchronously or asynchronously. 我们可以同步或异步发送消息。 Sessions can be automatically managed. 会话可以自动管理。

SOAP is language dependent, But SMTP is Language independent. SOAP依赖于语言,但SMTP与语言无关。 SOAP is mainly used for XML webservices. SOAP主要用于XML Web服务。 SMTP is also using protocol to get or post information. SMTP也使用协议来获取或发布信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM