To publish web services for consumption by remote applications, you create the web service using ColdFusion components. For more information on components, see Building and Using ColdFusion Components.
This section describes the following topics:
ColdFusion components (CFCs) encapsulate application functionality and provide a standard interface for client access to that functionality. A component typically contains one or more functions defined by the cffunction
tag.
For example, the following component contains a single function:
<cfcomponent> <cffunction name="echoString" returnType="string" output="no"> <cfargument name="input" type="string"> <cfreturn #arguments.input#> </cffunction> </cfcomponent>
The function, named echoString, echoes back any string passed to it. To publish the function as a web service, you must modify the function definition to add the access
attribute and specify remote, as the following example shows:
<cffunction name="echoString" returnType="string" output="no" access="remote"
>
By defining the function as remote, ColdFusion includes the function in the WSDL file. Only those functions marked as remote are accessible as a web service.
The following list defines the requirements for how to create web services for publication:
access
attribute of the cffunction
tag must be remote
.
cffunction
tag must include the returnType
attribute to specify a return type.
output
attribute of the cffunction
tag must be set to No
because ColdFusion converts all output to XML to return it to the consumer.
required="false"
for the cfargument
tag is ignored. ColdFusion considers all parameters as required.