Authenticating A User To The Application Server - MACROMEDIA FLASH REMOTING MX-USING FLASH REMOTING FOR FLASH MX 2004 ACTIONSCRIPT 2.0 Use Manual

Using flash remoting for flash mx 2004 actionscript 2.0
Table of Contents

Advertisement

For example, to create a service object for the Macromedia Pet Market catalog web service, specify
a line similar to the following:
petMarketCatalogService = gatewayConnection.getService("petmarket.api.
catalogservice", this);

Authenticating a user to the application server

In some cases, your application server might require you to provide user authentication—a user
name and password—before you can use a service.
Flash Remoting provides the
to specify authentication credentials to send to the application server. Flash Remoting sends the
credentials in the header of every service function call. This method is currently supported on the
following servers:
ColdFusion MX
JRun 4
To use the
setCredentials()
connection and before you call a service function. For a Flash application that is run by a single
user during a session, you can call the
gateway connection object. If you created the gateway object using the Service object, you can
access the connection object through the
provide authentication, as shown in the following example:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.ResultEvent;
import mx.rpc.FaultEvent
function getCategories_Result (re:ResultEvent):Void {
trace("Got Categories - " + re.result.length + " Record" + (re.result.
length>1?"s":""));
}
function getCategories_Fault (fault:FaultEvent):Void {
trace("CategoriesCallFailed-" + fault.fault.description);
}
var myResponder:RelayResponder = new
RelayResponder(this,"getCategories_Result","getCategories_Fault");
var petMarketService:Service = new Service(//establish connection
"http://examples.macromedia.com/flashservices/gateway",
null,
"petmarket.api.catalogservice",
null,
myResponder );
// set user credentials
petMarketService.connection.setCredentials("myUserName","myPassword");
// call service function
var temp_pc:PendingCall = petMarketService.getCategories("en_US");
Note: To ensure security, never include specific user names or passwords in ActionScript.
40
Chapter 2: Using Flash Remoting ActionScript
method of the Connection object to allow you
setCredentials()
method, call the method after you have created the gateway
setCredentials()
connection
method any time after creating the
property and call
setCredentials()
to

Advertisement

Table of Contents
loading
Need help?

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?

Questions and answers

This manual is also suitable for:

Flash remoting mx

Table of Contents