User Guide

Table Of Contents
900 Chapter 36: Using Web Services
In most cases, consumers of ColdFusion web services can easily pass data to and return results
from component functions by mapping their data types to the WSDL data types shown in the
preceding table.
Note: Document-literal web services use XML schema data types, not SOAP-ENC data types. For
more information, see “Publishing document-literal style web services” on page 904.
For ColdFusion structures and queries, clients might have to perform some processing to map
their data to the correct type. For more information, see “Publishing web services that use
complex data types” on page 912.
You can also define a data type in one ColdFusion component based on another component
definition. For more information on using components to specify a data type, see “Using
ColdFusion components to define data types for web services” on page 902.
Producing WSDL files
ColdFusion automatically creates a WSDL file for any component referenced as a web service.
For example, if you have a component named echo.cfc in your web root directory, you can view
its corresponding WSDL file by requesting the component as follows:
http://localhost/echo.cfc?wsdl
For example, you define a ColdFusion component as follows:
<cfcomponent>
<cffunction
name = "echoString"
returnType = "string"
output = "no"
access = "remote">
<cfargument name = "input" type = "string">
<cfreturn #arguments.input#>
</cffunction>
</cfcomponent>
Tip: If you register the component in Dreamweaver MX 2004, it appears in the Components tab of
the Application panel.
Requesting the WSDL file in a browser returns the following:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://ws"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://ws"
xmlns:intf="http://ws"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://rpc.xml.coldfusion"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
any complex type
component definition complex type
ColdFusion data type WSDL data type published