«^»
10. Describing a Web Service using WSDL

A complete WSDL file is given below. Here is an explanation of some parts of the file:

  1. The service element of a WSDL file gives basic information about the Web Service such as the location of the .asmx file and details about which ports (HTTP GET, HTTP POST and/or SOAP) are supported.
  2. There is a binding element for each of the ports. A binding element describes for each method (provided by the Web Service) the way in which a request is coded and the way in which the reply is coded. So it might say the request is in SOAP and the reply is in SOAP. Or it might say the request is url-encoded and the reply is given using some XML coding.
  3. There are two message elements for each of the ports. One of the message elements is used to give the name and the type of each parameter, and the other message element is used to describe the type of the result. So an In message element might say that there is one parameter called pCentigrade that is a double and the corresponding Out message element might say that a double is returned.
A fuller description of the purpose of the various parts of a WSDL file is provided by [21].

Here is a WSDL file that could be used to describe the Web Service being offered by Service1.asmx:

0384: <?xml version="1.0" encoding="utf-8"?>
0385: <definitions 
0386:  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
0387:  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
0388:  xmlns:s="http://www.w3.org/2001/XMLSchema" 
0389:  xmlns:s0="http://www.a.com/webservices/" 
0390:  xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
0391:  xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
0392:  xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
0393:  targetNamespace="http://www.a.com/webservices/" 
0394:  xmlns="http://schemas.xmlsoap.org/wsdl/">
0395:   <types>
0396:     <s:schema 
0397:       elementFormDefault="qualified" 
0398:       targetNamespace="http://www.a.com/webservices/">
0399:       <s:element name="ToFahrenheit">
0400:         <s:complexType>
0401:           <s:sequence>
0402:             <s:element minOccurs="1" maxOccurs="1" name="pCentigrade" 
0403:               type="s:double" />
0404:           </s:sequence>
0405:         </s:complexType>
0406:       </s:element>
0407:       <s:element name="ToFahrenheitResponse">
0408:         <s:complexType>
0409:           <s:sequence>
0410:             <s:element minOccurs="1" maxOccurs="1" name="ToFahrenheitResult"
0411:               type="s:double" />
0412:           </s:sequence>
0413:         </s:complexType>
0414:       </s:element>
0415:     </s:schema>
0416:   </types>
0417:   <message name="ToFahrenheitSoapIn">
0418:     <part name="parameters" element="s0:ToFahrenheit" />
0419:   </message>
0420:   <message name="ToFahrenheitSoapOut">
0421:     <part name="parameters" element="s0:ToFahrenheitResponse" />
0422:   </message>
0423:   <portType name="Service1Soap">
0424:     <operation name="ToFahrenheit">
0425:       <documentation>This converts from Centigrade to Fahrenheit.</documentation>
0426:       <input message="s0:ToFahrenheitSoapIn" />
0427:       <output message="s0:ToFahrenheitSoapOut" />
0428:     </operation>
0429:   </portType>
0430:   <binding name="Service1Soap" type="s0:Service1Soap">
0431:     <soap:binding transport="http://schemas.xmlsoap.org/soap/http" 
0432:       style="document" />
0433:     <operation name="ToFahrenheit">
0434:       <soap:operation 
0435:         soapAction="http://www.a.com/webservices/ToFahrenheit"
0436:         style="document" />
0437:       <input>
0438:         <soap:body use="literal" />
0439:       </input>
0440:       <output>
0441:         <soap:body use="literal" />
0442:       </output>
0443:     </operation>
0444:   </binding>
0445:   <service name="Service1">
0446:     <documentation>This Web Service provides temperature conversion
0447:       services.</documentation>
0448:     <port name="Service1Soap" binding="s0:Service1Soap">
0449:       <soap:address 
0450:         location="http://www.a.com/wsud/cs/ServerConvert/Service1.asmx" />
0451:     </port>
0452:   </service>
0453: </definitions>