User Guide

Table Of Contents
896 Chapter 36: Using Web Services
Configuring web services in the ColdFusion MX Administrator
The ColdFusion MX Administrator lets you register web services so that you do not have to
specify the entire WSDL URL when you reference the web service.
Note: The first time you reference a web service, ColdFusion MX automatically registers it in the
Administrator.
For example, the following code references the URL to the TemperatureService WSDL file:
<cfscript>
ws = CreateObject("webservice",
"http://www.xmethods.net/sd/2001/TemperatureService.wsdl");
xlatstring = ws.getTemp("55987");
writeoutput(xlatstring);
</cfscript>
If you register the TemperatureService web service in the Administrator using (for example, the
name wsTemp), you can then reference the web service as follows:
<cfscript>
ws = CreateObject("webservice", "wsTemp");
xlatstring = ws.getTemp("55987");
writeoutput("wsTemp: " & xlatstring);
</cfscript>
Not only does this enable you to shorten your code, registering a web service in the Administrator
lets you change a web service’s URL without modifying your code. So, if the TemperatureService
web service moves to a new location, you only update the administrator setting, not your
application code.
For more information, see the ColdFusion MX Administrator online Help.
Data conversions between ColdFusion and WSDL data types
A WSDL file defines the input and return parameters of an operation, including data types. For
example, the TemperatureService web service contains the following definition of input and
return parameters:
<message name="getTempRequest">
<part name="zipcode" type="xsd:string"/>
</message>
<message name="getTempResponse">
<part name="return" type="xsd:float"/>
</message>
As part of consuming web services, you must understand how ColdFusion MX converts WSDL
defined data types to ColdFusion data types. The following table shows this conversion:
ColdFusion data type WSDL data type
numeric SOAP-ENC:double
boolean SOAP-ENC:boolean
string SOAP-ENC:string