Adobe COLDFUSION 9 Manual page 1109

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Note: For a list of how ColdFusion data types map to WSDL data types, see
WSDL data
types" on page 1103.
The following example shows a ColdFusion component that takes a query as input and echoes the query back to the
caller:
<cfcomponent>
<cffunction name='echoQuery' returnType='query' access='remote'>
<cfargument name='input' type='query'>
<cfreturn #arguments.input#>
</cffunction>
</cfcomponent>
In the WSDL file for the echotypes.cfc component, you see the following definitions that specify the type of the
function input and output as QueryBean:
<wsdl:message name="echoQueryResponse">
<wsdl:part name="echoQueryReturn" type="tns1:QueryBean"/>
</wsdl:message>
<wsdl:message name="echoQueryRequest">
<wsdl:part name="input" type="tns1:QueryBean"/>
</wsdl:message>
For information on displaying WSDL, see
Since ColdFusion automatically handles mappings to ColdFusion data types, you can call this web service as the
following example shows:
<head>
<title>Passing queries to web services</title>
</head>
<body>
<cfquery name="GetEmployees" datasource="cfdocexamples">
SELECT FirstName, LastName, Salary
FROM Employee
</cfquery>
<cfinvoke
webservice = "http://localhost/echotypes.cfc?wsdl"
method = "echoQuery"
input="#GetEmployees#"
returnVariable = "returnedQuery">
<cfoutput>
Is returned result a query? #isQuery(returnedQuery)# <br><br>
</cfoutput>
<cfoutput query="returnedQuery">
#FirstName#, #LastName#, #Salary#<br>
</cfoutput>
</body>
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
"Producing WSDL
files" on page 1106.
"Building and Using ColdFusion
Last updated 8/5/2010
"Data conversions between ColdFusion and
Components" on page 177.
1104

Advertisement

Table of Contents
loading

Table of Contents