Service type
ColdFusion pages (.cfm)
ColdFusion components (.cfc)
Note: Calling web services using Flash Remoting is supported only in Flash Remoting for ASP.Net
and in the Flash Remoting support included with ColdFusion MX. Flash Remoting for Java and the
Flash Remoting support in JRun do not support calling web services using Flash Remoting.
Calling functions using named arguments in ColdFusion
If you are calling a ColdFusion page or ColdFusion component that can take named arguments,
you can also call a service function and pass it a single ActionScript object that contains
name-value pairs for the arguments, as shown in the following example:
myService.myFunction({dept: "Sales", name: "BobZ"});
The ColdFusion page or component uses the object elements, dept and name, as named
arguments. For more information, see
on page
106.
Handling service results and errors
When you call a service function, there are two possible outcomes: the result that you expect or a
fault (error). These outcomes are relayed to a result handler method and an error handler method,
respectively, which you specify. For example, a result handler could display the results in the Flash
application, while an error handler might call trace functions to report the error descriptions. You
can specify the result and fault handling methods either for all results and faults that occur for the
service or for specific server function calls.
In both cases, you specify a responder object. The responder object can be any ActionScript
object that implments the mx.rpc.Responder interface. The Responder interface exposes two
methods (
onResult()
pending call. For convenience Flash Remoting API provides an implementation of the mx.rpc.
Responder interface that you can use: mx.rpc.RelayResponder.
The RelayResponder relays any result and fault responses to any object and any method of that
object. To specify the methods that handle the result and the fault conditions, the constructor for
the RelayResponder object has, as its second and third parameters, the names of the methods that
handle the ResultEvent and FaultEvent objects that the service method returns. The first
parameter specifies the name of the object that contains these methods. For example, the
RelayResponder in the HelloWorld example specifies that the result handling method is
helloWorld_Result()
contains them is this class (this).
pc.responder = new RelayResponder( this, "helloWorld_Result",
"helloWorld_Fault" );
Note: Do not specify result handler and fault handler methods when you create the service object and
when you call a service function. Specifying methods in both places can cause errors in your
application that might be difficult to diagnose.
"Passing parameters to ColdFusion components"
and
) that respond to the results and faults for the current
onFault()
, the fault handling method is
Function name
ColdFusion page (without the cfm suffix)
Component method
helloWorld_Fault()
Handling service results and errors
, and the class that
43
Need help?
Do you have a question about the FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 and is the answer not in the manual?