Publishing Web Services; Creating Components For Web Services; Specifying Data Types Of Function Arguments And Return Values - MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual

Developing coldfusion mx applications
Table of Contents

Advertisement

Publishing web services

To publish web services for consumption by remote applications, you create the web service using
ColdFusion components. For more information on components, see
Using ColdFusion Components," on page

Creating components for web services

ColdFusion components 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
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
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:
The value of the
1
The
2
cffunction
If the function does not return anything, set its
The
attribute of the
3
output
output to XML to return it to the consumer.
The attribute setting
4
considers all parameters as required.

Specifying data types of function arguments and return values

The
cffunction
passed to a function. As part of the function definition, you include the data type of the return
value and input parameters.
The following example shows a component that defines a function with a return value of type
string, one input parameter of type string, and one input parameter of type numeric:
<cfcomponent>
<cffunction name="trimString" returnType="string" output="no">
<cfargument name="inString" type="string">
<cfargument name="trimLength" type="numeric">
</cffunction>
</cfcomponent>
tag.
attribute of the
access
tag must include the
cffunction
required="false"
tag lets you define a single return value and one or more input parameters
219.
tag must be
cffunction
attribute to specify a return type.
returnType
returnType
tag must be set to
No
for the
cfargument
Chapter 11, "Building and
attribute, as the
access
.
remote
attribute to
.
void
because ColdFusion converts all
tag is ignored. ColdFusion

Publishing web services

721

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents