首頁 後端開發 XML/RSS教程 XML模式-WSD的描述

XML模式-WSD的描述

Mar 14, 2017 pm 04:17 PM

Web 服務描述語言(Web Services Description Language,WSDL)提供了一種描述 Web 服務(大多使用 SOAP)的簡單方法。 WSDL 可讓您描述利用 SOAP 標準所提供的服務和介面。 比方說,可以建立描述某台伺服器上提供的服務的WSDL 文件,然後把該文件分發給需要這些服務的W
Web 服務描述語言(Web Services Description Language,WSDL)提供了一種描述Web 服務(大多使用SOAP)的簡單方法。 WSDL 可讓您描述利用 SOAP 標準所提供的服務和介面。
比方說,可以建立描述某台伺服器上提供的服務的 WSDL 文件,然後把該文件分發給需要這些服務的 Web 服務消費者。透過閱讀和解析 WSDL 文件,消費者能夠了解到使用這些 Web 服務需要知道的所有信息,包括可以交換的資料類型、參數以及傳回的各種錯誤和其他資訊。
再次使用來自W3C 的例子,可以看到不同遠端函數的宣告和交換的資料都是透過結構的XML 定義處理的,如清單3 所示。
清單3. 不同遠端函數和交換資料的XML 定義

             

 <?xml version="1.0"?>



<!-- root element wsdl:definitions defines set of related services -->

<wsdl:definitions name="EndorsementSearch"

  targetNamespace="http://namespaces.snowboard-info.com"

  xmlns:es="http://www.snowboard-info.com/EndorsementSearch.wsdl"

  xmlns:esxsd="http://schemas.snowboard-info.com/EndorsementSearch.xsd"

  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">



  <!-- wsdl:types encapsulates schema definitions of communication types; 

                                                       here using xsd -->

  <wsdl:types>



    <!-- all type declarations are in a chunk of xsd -->

    <xsd:schema targetNamespace="http://namespaces.snowboard-info.com"

      xmlns:xsd="http://www.w3.org/1999/XMLSchema">



      <!-- xsd definition: GetEndorsingBoarder [manufacturer string, 

                                                        model string] -->

      <xsd:element name="GetEndorsingBoarder">

  <xsd:complexType>

    <xsd:sequence>

      <xsd:element name="manufacturer" type="string"/>

            <xsd:element name="model" type="string"/>

    </xsd:sequence>

  </xsd:complexType>

      </xsd:element>



      <!-- xsd definition: GetEndorsingBoarderResponse 

[... endorsingBoarder string ...] -->

      <xsd:element name="GetEndorsingBoarderResponse">

  <xsd:complexType>

    <xsd:all>

      <xsd:element name="endorsingBoarder" type="string"/>

    </xsd:all>

  </xsd:complexType>

      </xsd:element>



      <!-- xsd definition: GetEndorsingBoarderFault 

[... errorMessage string ...] -->

      <xsd:element name="GetEndorsingBoarderFault">

  <xsd:complexType>

    <xsd:all>

      <xsd:element name="errorMessage" type="string"/>

    </xsd:all>

  </xsd:complexType>

      </xsd:element>



    </xsd:schema>

  </wsdl:types>



  <!-- wsdl:message elements describe potential transactions -->



  <!-- request GetEndorsingBoarderRequest is of type GetEndorsingBoarder -->

  <wsdl:message name="GetEndorsingBoarderRequest">

    <wsdl:part name="body" element="esxsd:GetEndorsingBoarder"/>

  </wsdl:message>



  <!-- response GetEndorsingBoarderResponse is of type 

                                       GetEndorsingBoarderResponse -->

  <wsdl:message name="GetEndorsingBoarderResponse">

    <wsdl:part name="body" element="esxsd:GetEndorsingBoarderResponse"/>

  </wsdl:message>



  <!-- wsdl:portType describes messages in an operation -->

  <wsdl:portType name="GetEndorsingBoarderPortType">



    <!-- the value of wsdl:operation eludes me -->

    <wsdl:operation name="GetEndorsingBoarder">

      <wsdl:input message="es:GetEndorsingBoarderRequest"/>

      <wsdl:output message="es:GetEndorsingBoarderResponse"/>

      <wsdl:fault message="es:GetEndorsingBoarderFault"/>

    </wsdl:operation>

  </wsdl:portType>



  <!-- wsdl:binding states a serialization protocol for this service -->

  <wsdl:binding name="EndorsementSearchSoapBinding"

                type="es:GetEndorsingBoarderPortType">



    <!-- leverage off soap:binding document style ...(no wsdl:foo pointing at 

the soap binding) -->

    <soap:binding style="document"

                  transport="http://schemas.xmlsoap.org/soap/http"/>



    <!-- semi-opaque container of network transport details classed by 

soap:binding above ... -->

    <wsdl:operation name="GetEndorsingBoarder">



      <!-- again bind to SOAP? ... -->

      <soap:operation soapAction="http://www.snowboard-info.com/

EndorsementSearch"/>



      <!-- further specify that the messages in the wsdl:operation 

"GetEndorsingBoarder" use SOAP? ... -->

      <wsdl:input>

        <soap:body use="literal"

       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>

      </wsdl:input>

      <wsdl:output>

        <soap:body use="literal"

       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>

      </wsdl:output>

      <wsdl:fault>

        <soap:body use="literal"

       namespace="http://schemas.snowboard-info.com/EndorsementSearch.xsd"/>

      </wsdl:fault>

    </wsdl:operation>

  </wsdl:binding>



  <!-- wsdl:service names a new service "EndorsementSearchService" -->

  <wsdl:service name="EndorsementSearchService">

    <wsdl:documentation>snowboarding-info.com Endorsement Service</

wsdl:documentation> 



    <!-- connect it to the binding "EndorsementSearchSoapBinding" above -->

    <wsdl:port name="GetEndorsingBoarderPort"

               binding="es:EndorsementSearchSoapBinding">



      <!-- give the binding an network address -->

      <soap:address location="http://www.snowboard-info.com/EndorsementSearch"/>

    </wsdl:port>

  </wsdl:service>



 </wsdl:definitions>
登入後複製

WSDL 宣告了訊息類型、預設資料類型和內容以及交換的資料結構。
存取伺服器上 SOAP 結構需要使用的一切資訊都可以在這個 WSDL 中找到。大多數語言和環境都提供一種閱讀和解析 WSDL 的機制,以確定可用的函數和資料交換。
WSDL 不僅定義了用於交換資訊的 SOAP 接口,透過適當的 WSDL 產生程序,還可用於建立傳送請求、產生並格式化回應所需的程式碼。
WSDL 和 SOAP 組成了一個強大的遠端過程呼叫系統。                                                

#

以上是XML模式-WSD的描述的詳細內容。更多資訊請關注PHP中文網其他相關文章!

本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

Video Face Swap

Video Face Swap

使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的程式碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

SublimeText3 Mac版

SublimeText3 Mac版

神級程式碼編輯軟體(SublimeText3)

能否用PowerPoint開啟XML文件 能否用PowerPoint開啟XML文件 Feb 19, 2024 pm 09:06 PM

XML檔可以用PPT開啟嗎? XML,即可擴展標記語言(ExtensibleMarkupLanguage),是一種廣泛應用於資料交換和資料儲存的通用標記語言。與HTML相比,XML更加靈活,能夠定義自己的標籤和資料結構,使得資料的儲存和交換更加方便和統一。而PPT,即PowerPoint,是微軟公司開發的一種用於創建簡報的軟體。它提供了圖文並茂的方

使用Python實現XML資料的合併與去重 使用Python實現XML資料的合併與去重 Aug 07, 2023 am 11:33 AM

使用Python實現XML資料的合併和去重XML(eXtensibleMarkupLanguage)是一種用於儲存和傳輸資料的標記語言。在處理XML資料時,有時候我們需要將多個XML檔案合併成一個,或移除重複的資料。本文將介紹如何使用Python實現XML資料的合併和去重的方法,並給出對應的程式碼範例。一、XML資料合併當我們有多個XML文件,需要將其合

Python中的XML資料轉換為CSV格式 Python中的XML資料轉換為CSV格式 Aug 11, 2023 pm 07:41 PM

Python中的XML資料轉換為CSV格式XML(ExtensibleMarkupLanguage)是一種可擴充標記語言,常用於資料的儲存與傳輸。而CSV(CommaSeparatedValues)則是一種以逗號分隔的文字檔案格式,常用於資料的匯入和匯出。在處理資料時,有時需要將XML資料轉換為CSV格式以便於分析和處理。 Python作為一種功能強大

使用Python實現XML資料的篩選和排序 使用Python實現XML資料的篩選和排序 Aug 07, 2023 pm 04:17 PM

使用Python實現XML資料的篩選和排序引言:XML是一種常用的資料交換格式,它以標籤和屬性的形式儲存資料。在處理XML資料時,我們經常需要對資料進行篩選和排序。 Python提供了許多有用的工具和函式庫來處理XML數據,本文將介紹如何使用Python實現XML資料的篩選和排序。讀取XML檔案在開始之前,我們需要先讀取XML檔案。 Python有許多XML處理函式庫,

Python實作XML與JSON之間的轉換 Python實作XML與JSON之間的轉換 Aug 07, 2023 pm 07:10 PM

Python實作XML與JSON之間的轉換導語:在日常的開發過程中,我們常常需要將資料在不同的格式之間轉換。 XML和JSON是常見的資料交換格式,在Python中,我們可以使用各種函式庫來實作XML和JSON之間的相互轉換。本文將介紹幾種常用的方法,並附帶程式碼範例。一、XML轉JSON在Python中,我們可以使用xml.etree.ElementTree模

使用Python處理XML中的錯誤和異常 使用Python處理XML中的錯誤和異常 Aug 08, 2023 pm 12:25 PM

使用Python處理XML中的錯誤和異常XML是一種常用的資料格式,用於儲存和表示結構化的資料。當我們使用Python處理XML時,有時可能會遇到一些錯誤和異常。在本篇文章中,我將介紹如何使用Python來處理XML中的錯誤和異常,並提供一些範例程式碼供參考。使用try-except語句捕捉XML解析錯誤當我們使用Python解析XML時,有時候可能會遇到一些

Python解析XML中的特殊字元和轉義序列 Python解析XML中的特殊字元和轉義序列 Aug 08, 2023 pm 12:46 PM

Python解析XML中的特殊字元和轉義序列XML(eXtensibleMarkupLanguage)是一種常用的資料交換格式,用於在不同系統之間傳輸和儲存資料。在處理XML檔案時,經常會遇到包含特殊字元和轉義序列的情況,這可能會導致解析錯誤或誤解資料。因此,在使用Python解析XML檔案時,我們需要了解如何處理這些特殊字元和轉義序列。一、特殊字元和

C#開發中如何處理XML和JSON資料格式 C#開發中如何處理XML和JSON資料格式 Oct 09, 2023 pm 06:15 PM

C#開發中如何處理XML和JSON資料格式,需要具體程式碼範例在現代軟體開發中,XML和JSON是廣泛應用的兩種資料格式。 XML(可擴展標記語言)是一種用於儲存和傳輸資料的標記語言,而JSON(JavaScript物件表示)是一種輕量級的資料交換格式。在C#開發中,我們經常需要處理和操作XML和JSON數據,本文將重點放在如何使用C#處理這兩種數據格式,並附上

See all articles