Annotated WSDL Examples

Here are some WSDL examples I annotated to make it easier to keep track of the referrers and referents. Perhaps someone else will find this helpful. See also the annotated RDF WSDL examples.

If you'd like to come at this from the perspective of a client discovering and using advertised services, follow the links from the snowboard endorsement service and the stock quote service.

Uche Ogbuji's snowboard example

SOAP request

<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <m:GetEndorsingBoarder xmlns:m="http://namespaces.snowboard-info.com">
      <manufacturer>K2</manufacturer>
      <model>Fatbob</model>
    </m:GetEndorsingBoarder>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

SOAP response

<SOAP-ENV:Envelope
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
  <SOAP-ENV:Body>
    <m:GetEndorsingBoarderResponse xmlns:m="http://namespaces.snowboard-info.com">
      <endorsingBoarder>Chris Englesmann</endorsingBoarder>
    </m:GetEndorsingBoarderResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

WSDL description

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

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


from the spec example 1

WSDL description

<?xml version="1.0"?>

<!-- root element wsdl:definitions defines set of related services -->
<definitions name="StockQuote"
             targetNamespace="http://example.com/stockquote.wsdl"
             xmlns:tns="http://example.com/stockquote.wsdl"
             xmlns:xsd1="http://example.com/stockquote.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://example.com/stockquote.xsd"
              xmlns:xsd="http://www.w3.org/2000/10/XMLSchema">


           <!-- xsd definition: TradePriceRequest [... tickerSymbol string ...] -->
           <xsd:element name="TradePriceRequest">
              <xsd:complexType>
                  <xsd:all>
                      <xsd:element name="tickerSymbol" type="string"/>
                  </xsd:all>
              </xsd:complexType>
           </xsd:element>


           <!-- xsd definition: TradePrice [... price float ...] -->
           <xsd:element name="TradePrice">
              xsd:<complexType>
                  <xsd:all>
                      <xsd:element name="price" type="float"/>
                  </xsd:all>
              </xsd:complexType>
           </xsd:element>

       </xsd:schema>
    </wsdl:types>

    <!-- request GetLastTradePriceInput is of type TradePriceRequest -->
    <wsdl:message name="GetLastTradePriceInput">
        <wsdl:part name="body" element="xsd1:TradePriceRequest"/>
    </wsdl:message>

    <!-- request GetLastTradePriceOutput is of type TradePrice -->
    <wsdl:message name="GetLastTradePriceOutput">
        <wsdl:part name="body" element="xsd1:TradePrice"/>
    </wsdl:message>

    <!-- wsdl:portType describes messages in an operation -->
    <wsdl:portType name="StockQuotePortType">

    <!-- the value of wsdl:operation eludes me -->
        <wsdl:operation name="GetLastTradePrice">
           <wsdl:input message="tns:GetLastTradePriceInput"/>
           <wsdl:output message="tns:GetLastTradePriceOutput"/>
        </wsdl:operation>
    </wsdl:portType>

    <!-- wsdl:binding states a serialization protocol for this service -->
    <wsdl:binding name="StockQuoteSoapBinding"
                  type="tns:StockQuotePortType">

        <!-- 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="GetLastTradePrice">

           <!-- again bind to SOAP? @@@ -->
           <soap:operation soapAction="http://example.com/GetLastTradePrice"/>
           <!-- furthur specify that the messages in the wsdl:operation "" use SOAP? @@@ -->
           <wsdl:input>
               <soap:body use="literal"/>
           </wsdl:input>
           <wsdl:output>
               <soap:body use="literal"/>
           </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

    <!-- wsdl:service names a new service "StockQuoteService" -->
    <wsdl:service name="StockQuoteService">
        <wsdl:documentation>My first service</documentation>

        <!-- connect it to the binding "StockQuoteBinding" above -->
        <wsdl:port name="StockQuotePort"
                   binding="tns:StockQuoteBinding">

           <!-- give the binding an network address -->
           <soap:address location="http://example.com/stockquote"/>
        </wsdl:port>
    </wsdl:service>

</wsdl:definitions>

Valid XHTML 1.0!

Eric Prud'hommeaux
Last modified: Mon Mar 26 11:12:20 EST 2001