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 www.w3.org/TR/wsdl.
To publish a web service, you construct the service's functionality and then create the WSDL file defining the service. In ColdFusion MX, 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 Building and Using ColdFusion Components.
The Dreamweaver MX 2004 Components tab lets you view web services, including operation names, parameter names, and parameter data types.
The Add Using WSDL dialog box appears.
After the web service is defined to Dreamweaver MX 2004, you can drag it onto a page to call it using the cfinvoke
tag.
For more information on using Dreamweaver MX 2004, see its online Help system.
Note: The Web Services option is not available if you are running Dreamweaver MX 2004 on the Macintosh. However, you can still use web services by writing code manually.
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 2004, 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 TemperatureService web service:
<?xml version="1.0"?> <definitions
name="TemperatureService" targetNamespace="http://www.xmethods.net/sd/TemperatureService.wsdl" xmlns:tns="http://www.xmethods.net/sd/TemperatureService.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="getTempRequest"> <part name="zipcode" type="xsd:string"/> </message
> <message
name="getTempResponse"> <part name="return" type="xsd:float"/> </message
> <portType
name="TemperaturePortType"> <operation
name="getTemp"> <input message="tns:getTempRequest"/> <output message="tns:getTempResponse"/> </operation
> </portType
> <binding
name="TemperatureBinding" type="tns:TemperaturePortType"> <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> <operation
name="getTemp"> <soap:operation soapAction=""/> <input
> <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </input
> <output
> <soap:body use="encoded" namespace="urn:xmethods-Temperature" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> </output
> </operation
> </binding
> <service
name="TemperatureService"> <documentation>Returns current temperature in a given U.S. zipcode </documentation> <port
name="TemperaturePort" binding="tns:TemperatureBinding"> <soap:address location="http://services.xmethods.net:80/soap/servlet/rpcrouter"/></port>
</service>
</definitions>
The following are the major components of the WSDL file:
Component | Definition |
---|---|
|
The root element of the WSDL file. This area contains namespace definitions that you use to avoid naming conflicts between multiple web services. |
|
(Not shown) Defines data types used by the service's messages. |
|
Defines the data transferred by a web service operation, typically the name and data type of input parameters and return values. |
|
Defines one or more operations provided by the web service. |
|
Defines an operation that can be remotely invoked. |
|
Specifies an input parameter to the operation using a previously defined message. |
|
Specifies the return values from the operation using a previously defined message. |
|
(not shown) Optionally specifies an error message returned from the operation. |
|
Specifies the protocol used to access a web service including SOAP, HTTP GET and POST, and MIME. |
|
Defines a group of related operations. |
|
Defines an operation and its associated inputs and outputs. |
For additional descriptions of the contents of this WSDL file, see Consuming web services.