User Guide

Table Of Contents
Consuming web services 895
Calling web services from a Macromedia Flash client
The Flash Remoting service lets you call ColdFusion pages from a Flash client, but it does not let
you call web services directly. To call web services from a Flash client, you can use Flash Remoting
to call a ColdFusion component that calls the web service. The Flash client can pass input
parameters to the component, and the component can return to the Flash client any data
returned by the web service.
For more information, see Chapter 33, “Using the Flash Remoting Service,” on page 807.
Catching errors when consuming web services
Web services might throw errors, including SOAP faults, during processing that you can catch in
your application. If uncaught, these errors propagate to the browser.
To catch errors, you specify an error type of application to the ColdFusion
cfcatch tag, as the
following example shows:
<cftry>
Put your application code here ...
<cfcatch type="application">
<!--- Add exception processing code here ... --->
</cfcatch>
...
<cfcatch type="Any">
<!--- Add exception processing code appropriate for all other
exceptions here ... --->
</cfcatch>
</cftry>
For more information on error handling, see Chapter 14, “Handling Errors,” on page 307.
Handling inout and out parameters
Some web services define inout and out parameters. You use out parameters to pass a placeholder
for a return value to a web service. The web service then returns its result by writing it to the out
parameter. Inout parameters let you pass a value to a web service and lets the web service return its
result by overwriting the parameter value.
The following example shows a web service that takes as input an inout parameter containing a
string and writes its results back to the string:
<cfset S="foo">
<cfscript>
ws=createobject("webservice", "URLtoWSDL")
ws.modifyString("S");
<cfscript>
<cfoutput>#S#</cfoutput>
Even though this web service takes as input the value of S, because you pass it as an inout
parameter, you do not enclose it in number signs.
Note: ColdFusion MX supports the use of inout and out parameters to consume web services.
However, ColdFusion MX does not support inout and out parameters when creating web services for
publication.