WSDL files define the interface to a web service. To consume a web service, you access the service's WSDL file to determine information about it. If you publish your application logic as a web service, you must create a WSDL file for it.
WSDL is a draft standard supported by the World Wide Web Consortium. You can access the specification at the following URL:
To publish a web service, you construct the service's functionality and then create the WSDL file defining the service. In ColdFusion, you use components to create web services. ColdFusion automatically generates the WSDL file for a component that you use to produce a web service. For more information on creating web services, see "Publishing web services".
For more information on components, see Chapter 11, "Building and Using ColdFusion Components".
Dreamweaver MX contains a utility to view web services, including operation names, parameter names, and parameter data types. The following figure shows a WSDL file for the BabelFish web service:
This figure shows that the web service method babelFish returns a string, and that it takes string parameters named sourcedata and translationmode as input.
The Add Using WSDL dialog box appears.
For more information on using Dreamweaver MX, see its online Help system.
A WSDL file takes practice to read. You can view the WSDL file in a browser, or you can use a tool such as Dreamweaver MX, which contains a built-in utility for displaying WSDL files in an easy-to-read format.
The following example shows a WSDL file for the BabelFish web service:
<?xml version="1.0" ?>
<definitions name="BabelFishService" xmlns:tns="http://www.xmethods.net/sd/BabelFishService.wsdl" targetNamespace="http://www.xmethods.net/sd/BabelFishService.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns="http://schemas.xmlsoap.org/wsdl/"> <message name="BabelFishRequest"> <part name="translationmode" type="xsd:string" /> <part name="sourcedata" type="xsd:string" /> </message> <message name="BabelFishResponse"> <part name="return" type="xsd:string" /> </message> <portType name="BabelFishPortType"> <operation name="BabelFish"> <input message="tns:BabelFishRequest" /> <output message="tns:BabelFishResponse" /> </operation> </portType> <binding name="BabelFishBinding" type="tns:BabelFishPortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" /> <operation name="BabelFish"> <soap:operation soapAction="urn:xmethodsBabelFish#BabelFish" /> <input> <soap:body use="encoded" namespace="urn:xmethodsBabelFish" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </input> <output> <soap:body use="encoded" namespace="urn:xmethodsBabelFish" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> </output> </operation> </binding> <service name="BabelFishService"> <documentation>Translates text of up to 5k in length, between a variety of languages.</documentation> <port name="BabelFishPort" binding="tns:BabelFishBinding"> <soap:address location="http://services.xmethods.net:80/perl/soaplite.cgi" /> </port> </service> </definitions>
The following are the major components of the WSDL file:
For additional descriptions of the contents of this WSDL file, see "Consuming web services".