WSDL 1.1 (a 2001 W3C Note, still what services publish; WSDL 2.0, a 2007 Recommendation, saw little use) describes a service in layers: types (an embedded XSD), messages, a portType of operations, a binding to SOAP over HTTP and a service address. In the usual document/literal style each message is one schema element:
<definitions targetNamespace="urn:booknest:pricing" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="urn:booknest:pricing"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<types>
<xs:schema targetNamespace="urn:booknest:pricing" elementFormDefault="qualified">
<xs:element name="GetPrice"><xs:complexType><xs:sequence>
<xs:element name="sku" type="xs:string"/></xs:sequence></xs:complexType></xs:element>
<xs:element name="GetPriceResponse"><xs:complexType><xs:sequence>
<xs:element name="price" type="xs:decimal"/>
<xs:element name="inStock" type="xs:boolean"/>
</xs:sequence></xs:complexType></xs:element>
</xs:schema>
</types>
<message name="GetPriceIn"><part name="body" element="tns:GetPrice"/></message>
<message name="GetPriceOut"><part name="body" element="tns:GetPriceResponse"/></message>
<portType name="PricingPort">
<operation name="GetPrice">
<input message="tns:GetPriceIn"/><output message="tns:GetPriceOut"/></operation>
</portType>
<binding name="PricingSoap" type="tns:PricingPort">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetPrice"><soap:operation soapAction="urn:booknest:pricing#GetPrice"/>
<input><soap:body use="literal"/></input><output><soap:body use="literal"/></output>
</operation>
</binding>
<service name="PricingService">
<port name="PricingSoapPort" binding="tns:PricingSoap">
<soap:address location="http://localhost:31081/soap"/></port>
</service>
</definitions>Java and .NET tools generate client classes from it; zeep reads it at run time (next listing).
WSDL
The Web Services Description Language (WSDL) defines the functionalities offered by a web service. It is often used together with SOAP and XSD.A WSDL file can be read by a client program to find out what operations are available on the server. Any special datatypes 30 used are embedded in the form of XSD. SOAP can then be used to call one of the operations over HTTP.
<definitions name="HelloService"
targetNamespace="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="SayHelloRequest">
<part name="firstName" type="xsd:string"/>
</message>
<message name="SayHelloResponse">
<part name="greeting" type="xsd:string"/>
</message>
<portType name="Hello_PortType">
<operation name="sayHello">
<input message="tns:SayHelloRequest"/>
<output message="tns:SayHelloResponse"/>
</operation>
</portType>
<binding name="Hello_Binding" type="tns:Hello_PortType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="sayHello">
<soap:operation soapAction="sayHello"/>
<input>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</input>
<output>
<soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:examples:helloservice"
use="encoded"/>
</output>
</operation>
</binding>
<service name="Hello_Service">
<documentation>WSDL File for HelloService</documentation>
<port binding="tns:Hello_Binding" name="Hello_Port"/>
<soap:address
location="http://www.examples.com/SayHello/">
</port>
</service>
</definitions>
Example adapted from http://www.tutorialspoint.com/wsdl/wsdl_example.htm 10,792 .