Building Flash applications with Flash Remoting
21
■
The
serviceName
, which is the name of the remote service. To select the appropriate value
for this example, see the table that follows this section.
■
The two
null
values represent the
connection
and
responder
parameters, which are not
used in this case. For information about these parameters, see the constructor for the Service
class in Flash Remoting ActionScript Dictionary Help.
The
serviceFunctionName
is the name of the service function that you call. To select the
appropriate value for this example, see the table that follows this section.
The call to the
howdyService.
serviceFunctionName
()
service function returns a
PendingCall object, called
pc
in this example. It contains a
responder
property which the
application sets with a RelayResponder object. The RelayResponder object specifies the object
(first parameter) that contains the methods that handle the values returned by the service
function. The second parameter in the RelayResponder constructor specifies the result handler
method and the third parameter specifies the fault handler method.
This example handles the results returned by the service function using
callback functions
named
serviceFunctionName
_Result()
or
serviceFunctionName
_Fault()
. If the call to
the service function succeeds, the
_Result
function is called and it processes the result. If the
service function fails, the
_Fault
function is called to handle the error.
The result, which is the value that you expect from the service function, is returned in a
ResultEvent object. The fault, which the service returns for an error condition, is returned in a
FaultEvent object.
For more information about connecting to remote services and handling results, see
Chapter 2,
“Using Flash Remoting ActionScript,” on page 29
.
6.
Save the file.
In the preceding ActionScript code, substitute the values from the following table for the
serviceName
and
serviceFunctionName
variables, in accordance with the remote service that
you are using:
For more information about application server-specific service names and service function names,
see the following chapters:
•
Chapter 6, “Using Flash Remoting with ColdFusion MX,” on page 97
•
Chapter 7, “Using Flash Remoting for Java,” on page 119
•
Chapter 8, “Using Flash Remoting for Microsoft .NET,” on page 143
Remote service
serviceName
variable
serviceFunctionName
variable
ColdFusion MX
remoteservices
helloWorld
JRun 4
com.remoteservices
helloWorldJava
ASP.NET
remoteservices
helloWorldNET
Web service
http://services.xmethods.net/soap/
urn:xmethods-delayed-quotes.wsdl
getQuote