Calling service functions
41
Flash supplies the login credentials with each service request; therefore, your ActionScript should
log the user out of the application server and reset the credentials when the user logs out of your
Flash application.
To log out the user and reset the credentials:
1.
Call a logout service function on the server that logs out the user.
For example, for ColdFusion, call a method that uses the
cflogout
tag.
2.
Set the gateway connection credential information to empty strings.
The following example shows these steps:
myService.logout();
gatewayConnection.setCredentials("", "");
The technique that you use to authenticate the user and to authorize access on the application
server depends on the application server you’re using.
Using authentication in ColdFusion MX
If you use ColdFusion, the
setCredentials()
method causes Flash Remoting to put the login
ID and password in the ColdFusion page’s CFLogin scope whenever you request a service. The
Application.cfm page for the ColdFusion page or ColdFusion component should process this
information as necessary in a
cflogin
tag. For more information on implementing security in
ColdFusion, see
“Securing access to ColdFusion from Flash Remoting” on page 116
.
Using authentication in JRun 4
Authentication in JRun 4 is only meaningful for EJBs, where you can use the
setCredentials()
method to enable access to secured EJB methods. You must configure your application server for
single sign-on. The Flash gateway provides the security credentials to the login module. For more
information on authentication in JRun 4, see
“Using Flash Remoting with JRun security”
on page 139
.
Calling service functions
To call the functions exposed by a Service object, you use the object name followed by the service
function name. In the following example,
petMarketService
is the Service object name and
getCategories()
is the name of the function that is called:
var temp_pc:PendingCall = petMarketService.getCategories("en_US");
The
getCategories()
function exists in the application server as a public method or application
page. The function also passes a string parameter,
"en_US"
, to specify the language in which the
function should return the categories. To pass multiple parameters to service functions, you
include a comma-separated list of values in the service function call. If the
getCategories()
function also allowed you to specify a type of category, for example, the parameters would look
like this:
petMarketService.getCategories("en_US", "Accessories");
Содержание FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT...
Страница 1: ...Using Flash Remoting for Flash MX 2004 ActionScript 2 0...
Страница 8: ...8 Contents...
Страница 62: ...62 Chapter 3 Using the RemotingConnector component Flash Professional only...
Страница 142: ...142 Chapter 7 Using Flash Remoting for Java...