ホームページ  >  記事  >  バックエンド開発  >  XML Schema-WSDの説明

XML Schema-WSDの説明

黄舟
黄舟オリジナル
2017-03-14 16:17:342072ブラウズ

Web サービス記述言語 (Web サービス記述 Language、WSDL) は、Web サービスを記述する簡単な方法を提供します (主に SOAP を使用)。 WSDL を使用すると、SOAP 標準を使用して提供されるサービスとインターフェイスを記述することができます。 たとえば、特定のサーバーで提供されるサービスを説明する WSDL ファイルを作成し、そのファイルをこれらのサービスを必要とする Web サービスに配布できます。Web サービス記述言語 (WSDL) は、Web サービスを記述する方法 (主に単純な方法) を提供します。 SOAPを使用)。 WSDL を使用すると、SOAP 標準によって提供されるサービスとインターフェイスを記述することができます。
たとえば、特定のサーバーで提供されるサービスを説明する WSDL ファイルを作成し、そのファイルをこれらのサービスを必要とする Web サービス利用者に配布できます。 WSDL ファイルを読み取って解析することで、消費者は、交換できる
データ型 、返されるさまざまなエラーやその他の情報など、Web サービスを使用するために知っておく必要があるすべてを学びます。 W3C
の例を再度使用すると、リスト 3 に示すように、さまざまなリモート 関数 の宣言と交換されるデータが構造の XML 定義を通じて処理されることがわかります。 リスト 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 Schema-WSDの説明の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。