ColdFusion 9.0 Resources |
Specifying data types of function arguments and return valuesThe cffunction tag lets you define a single return value and one or more input parameters 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> 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:
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.
For ColdFusion structures and queries, Some clients must process their data to map it to the correct type. For more information, see Publishing web services that use complex data types. 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. |