Adobe 38043740 - ColdFusion Standard - Mac Development Manual page 1110

Developing applications
Hide thumbs Also See for 38043740 - ColdFusion Standard - Mac:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Creating components for web services
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
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, modify
the function definition to add the
<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
attribute of the
1
access
The
tag must include the
2
cffunction
3
The
attribute of the
output
return it to the consumer.
4
The attribute setting
required="false"
as required.
Specifying data types of function arguments and return values
The
tag lets you define a single return value and one or more input parameters passed to a function. As
cffunction
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>
As part of publishing the component for access as a web service, ColdFusion generates the WSDL file that defines the
component where the WSDL file includes definitions for how ColdFusion data types map to WSDL data types. The
following table shows this mapping:
ColdFusion data type
numeric
Boolean
string
array
attribute and specify remote, as the following example shows:
access
tag must be
cffunction
attribute to specify a return type.
returnType
tag must be set to
cffunction
for the
cfargument
WSDL data type published
SOAP-ENC:double
SOAP-ENC:boolean
SOAP-ENC:string
SOAP-ENC:Array
Last updated 1/20/2012
.
remote
because ColdFusion converts all output to XML to
No
tag is ignored. ColdFusion considers all parameters
1105
tag.
cffunction

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion 9

Table of Contents