Web Service, SOAP和WSDL的關系


最近項目做的東西比較多,一個不做Web的人也要開始看各種Web相關的東東了,hohoho...這幾個概念最近一直在用,記錄一下。總結和分析了各種的材料來源有這里的園子,WIKIPEDIA,百度百科,ESRI的文檔庫,還有身邊有經驗的同事。有些來自WIKI或者文檔庫的文章就不翻譯了,原文表達的已經很到位了。

 

Web Service
Web services provide the ability for applications to communicate using messaging over many different protocols. Because web services provide a means to communicate between applications that are written both in the same programming language as well as in different programming languages, a language neutral means of communication was needed. XML is the format used to hold the information carried between the applications. The XML message is carried using SOAP (Simple Object Access Protocol). SOAP defines the headers and the valid means for passing messages. That passing of messages usually takes place over HTTP but it can actually be over any well know protocol, such as SMTP, FTP, or DCOM. SOAP takes the xml message and wraps it so that it can be routed to the receiving application and appropriaptely processed.

 

SOAP
簡單對象訪問協議,簡單對象訪問協議(SOAP)是一種輕量的、簡單的、基於 XML 的協議,它被設計成在 WEB 上交換結構化的信息。 SOAP 可以和現存的許多因特網協議和格式結合使用,包括超文本傳輸協議( HTTP),簡單郵件傳輸協議(SMTP),多用途網際郵件擴充協議(MIME)。它還支持從消息系統到遠程過程調用(RPC)等大量的應用程序。

WIKIPEDIA : SOAP, originally defined as Simple Object Access Protocol, is a protocol specification for exchanging structured information in the implementation of Web Services in computer networks. It relies on XML for its message format, and usually relies on other Application Layer protocols, most notably Hypertext Transfer Protocol (HTTP) and Simple Mail Transfer Protocol (SMTP), for message negotiation and transmission.

簡單對象訪問協議(SOAP)是W3C組織的一個Note, 它描述了一種在分散的或分布式的環境中如何交換信息的輕量級協議。SOAP是一個基於XML的協議,它包括三個部分:SOAP封裝(Envelop),封裝定義了一個描述消息中的內容是什么,是誰發送的,誰應當接受並處理它以及如何處理它們的框架;SOAP編碼規則(Encoding Rules),用於表示應用程序需要使用的數據類型的實例;SOAP RPC表示(RPC Representation),表示遠程過程調用和應答的協定;SOAP可以和多種傳輸協議綁定(Binding),使用底層協議交換信息。

SOAP 消息基本上是從發送端到接收端的單向傳輸,但它們常常結合起來執行類似於請求 / 應答的模式。所有的 SOAP 消息都使用 XML 編碼。一條 SOAP 消息就是一個包含有一個必需的 SOAP 的封裝包,一個可選的 SOAP 標頭和一個必需的 SOAP 體塊的 XML 文檔。

SOAP在HTTP協議的基礎上時,把編寫成XML的REQUEST參數, 放在HTTP BODY上提交給WEB SERVICE服務器(SERVLET,ASP什么的) 處理完成后,結果也寫成XML作為RESPONSE送回用戶端, 為了使用戶端和WEB SERVICE可以相互對應,可以使用WSDL作為這種通信方式的描述文件,利用WSDL工具可以自動生成WS和用戶端的框架文件,SOAP具備把復雜對象序列化捆綁到XML里去的能力。

SOAP也可以綁定到TCP和UDP協議上。

 

WSDL
WSDL describes what a web service does, what methods it contains, what parameters and types it knows how to use, and which ports it is using for communication. The WSDL defines the valid contents of the XML messages to be passed over SOAP. The WSDL acts as a specification, like IDL, to describe the interfaces and parameters on a web service. The methods available are usually grouped together in a "port", which can be thought of as a view to web services where different operations are exposed. A WSDL can contain one or more ports.

 

關系總結

總之SOAP是一個結構化數據交換的一個協議規范,用於WebService。SOAP基於XML,由於HTTP協議的應用廣泛支持(協議支持和80端口可達),多數SOAP應用是基於HTTP的。

SOAP是消息棧中位於HTTP協議之上的一層,Service調用達服務器后,TCP/IP層面,HTTP層面,SOAP協議層面依次逐級獲取各自的Payload,程序結合WSDL描述的WebService結構信息,最終生成/得到相應的對象,發起調用。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM