Packagesystem.remoting
Classpublic class RemotingService
InheritanceRemotingService Inheritance CoreAction Inheritance Task Inheritance Object

This class provides a service object to communicate with a remoting gateway server.

Example :

     package examples 
     {
         import core.dump;
         
         import system.remoting.RemotingService;
         
         import flash.display.Sprite;
         
         public class RemotingExample extends Sprite 
         {
             public function RemotingExample()
             {
                 var service:RemotingService = new RemotingService() ;
                 
                 service.finishIt.connect( finish ) ;
                 service.progressIt.connect( progress ) ;
                 service.startIt.connect( start ) ;
                 service.timeoutIt.connect( timeout ) ;
                 
                 service.error.connect( error  ) ;
                 service.fault.connect( fault  ) ;
                 service.result.connect( result ) ;
                 
                 service.gatewayUrl  = gatewayUrl ;
                 service.serviceName = "Test"  ;
                 service.methodName  = "hello" ;
                 
                 service.run( "world" ) ;
             }
             
             public var gatewayUrl:String = 
             "http://localhost:8888/maashaack/amfphp/gateway.php" ;
             
             //////////////// slots
             
             protected function error( error:, service:RemotingService ):void
             {
                 trace("error:" + dump(error) ) ;
             }
             
             protected function fault( fault:, service:RemotingService ):void
             {
                 trace("fault:" + dump(fault) ) ;
             }
             
             protected function finish( service:RemotingService ):void
             {
                 trace( "#finish" ) ;
             }
               
             protected function result( result:, service:RemotingService ):void
             {
                  trace("result : " + result ) ;
             }
             
             protected function start( service:RemotingService ):void
             {
                 trace( "#start : " + service ) ;
             }
               
             protected function timeout( service:RemotingService ):void
             {
                 trace( "#timeout" ) ;
             }
             
             ////////////////
         }
     }
     



Public Properties
 PropertyDefined By
 InheritedchangeIt : Signaler
This signal emit when the notifyChanged method is invoked.
CoreAction
 InheritedclearIt : Signaler
This signal emit when the notifyCleared method is invoked.
CoreAction
  connection : RemotingConnection
[read-only] The internal RemotingConnection reference.
RemotingService
  delay : uint
[read-only] Indicates the timeout interval duration (default 12000 ms).
RemotingService
  error : Signal
[read-only] This signal emit when the service receive a error message from the server
RemotingService
  fault : Signal
[read-only] This signal emit when the service receive a fault message from the server
RemotingService
 InheritedfinishIt : Signaler
This signal emit when the notifyFinished method is invoked.
Task
  gatewayUrl : String
Indicates a string containing a dot delimited path from the root of the Flash Remoting Server to the service name.
RemotingService
 InheritedinfoIt : Signaler
This signal emit when the notifyInfo method is invoked.
CoreAction
  listener : IRemotingServiceListener
Defines the IRemotingService reference of this remoting service.
RemotingService
 Inheritedlogger : Logger
Determinates the internal Logger reference of this Loggable object.
Task
 Inheritedlooping : Boolean
The flag to determinate if the Action object is looped.
CoreAction
 InheritedloopIt : Signaler
This signal emit when the notifyLooped method is invoked.
CoreAction
  methodName : String
Indicates the name of the server-side service's method.
RemotingService
  multipleSimultaneousAllowed : Boolean
Defines if the service can lauch multiple simultaneous connections.
RemotingService
  objectEncoding : uint = 3.0
The object encoding (AMF version) for the internal NetConnection instance.
RemotingService
  params : Array
Determinates the Array representation of all arguments to pass in the service method.
RemotingService
 InheritedpauseIt : Signaler
This signal emit when the notifyPause method is invoked.
CoreAction
 Inheritedphase : String
[read-only] The current phase of the action.
Task
 InheritedprogressIt : Signaler
This signal emit when the notifyProgress method is invoked.
CoreAction
  proxy : RemotingServiceProxy
[read-only] Determinates a RemotingServiceProxy of the current service to use simple methods to run remoting queries.
RemotingService
  result : Signal
[read-only] This signal emit when the service receive a result with success.
RemotingService
 InheritedresumeIt : Signaler
This signal emit when the notifyResumed method is invoked.
CoreAction
 Inheritedrunning : Boolean
[read-only] Indicates true if the process is in progress.
Task
  scope : String
The scope of this object ("prototype" or "singleton")
RemotingService
  serviceName : String
Indicates the name of the server-side service.
RemotingService
 InheritedstartIt : Signaler
This signal emit when the notifyStarted method is invoked.
Task
 InheritedstopIt : Signaler
This signal emit when the notifyStopped method is invoked.
CoreAction
 InheritedtimeoutIt : Signaler
This signal emit when the notifyTimeOut method is invoked.
CoreAction
  timeoutPolicy : TimeoutPolicy
Indicates the timeout policy value of this service.
RemotingService
Public Methods
 MethodDefined By
  
RemotingService(gatewayUrl:String = null, serviceName:String = null, methodName:String = null, params:Array = null)
Creates a new RemotingService instance.
RemotingService
  
clone():*
[override] Returns a shallow copy of this object.
RemotingService
 Inherited
isLocked():Boolean
Returns true if the object is locked.
Task
 Inherited
lock():void
Locks the object.
Task
 Inherited
Notify when the process is changed.
CoreAction
 Inherited
Notify when the process is cleared.
CoreAction
 Inherited
Notify an ActionEvent when the process is finished.
Task
 Inherited
notifyInfo(info:*):void
Notify a specific information when the process is changed.
CoreAction
 Inherited
Notify when the process is looped.
CoreAction
 Inherited
Notify when the process is paused.
CoreAction
 Inherited
Notify when the process is in progress.
CoreAction
 Inherited
Notify when the process is resumed.
CoreAction
 Inherited
Notify an ActionEvent when the process is started.
Task
 Inherited
Notify when the process is stopped.
CoreAction
 Inherited
Notify when the process is out of time.
CoreAction
  
registerClassAlias(aliasName:String, classObject:Class):void
[static] Preserves the class (type) of an object when the object is encoded in Action Message Format (AMF).
RemotingService
  
run(... arguments):void
[override] Run the process of the remoting service.
RemotingService
  
setCredentials(authentification:RemotingAuthentification = null):void
Defines a set of credentials to be presented to the server on all subsequent requests.
RemotingService
  
setDelay(time:uint, useSeconds:Boolean = false):void
Set timeout interval duration.
RemotingService
  
toString():String
Returns the String representation of this object.
RemotingService
 Inherited
unlock():void
Unlocks the display.
Task
Protected Methods
 MethodDefined By
 Inherited
setRunning(b:Boolean):void
Changes the running property value.
Task
Public Constants
 ConstantDefined By
  DEFAULT_DELAY : uint = 25000
[static] The default delay value before notify the timeout event (25 seconds)
RemotingService
  LEVEL_ERROR : String = error
[static] The string representation value of the level error of the service.
RemotingService
Property Detail
connectionproperty
connection:RemotingConnection  [read-only]

The internal RemotingConnection reference.


Implementation
    public function get connection():RemotingConnection
delayproperty 
delay:uint  [read-only]

Indicates the timeout interval duration (default 12000 ms).

Uses the setDelay() method to change this value.


Implementation
    public function get delay():uint
errorproperty 
error:Signal  [read-only]

This signal emit when the service receive a error message from the server


Implementation
    public function get error():Signal
faultproperty 
fault:Signal  [read-only]

This signal emit when the service receive a fault message from the server


Implementation
    public function get fault():Signal
gatewayUrlproperty 
gatewayUrl:String

Indicates a string containing a dot delimited path from the root of the Flash Remoting Server to the service name.


Implementation
    public function get gatewayUrl():String
    public function set gatewayUrl(value:String):void
listenerproperty 
listener:IRemotingServiceListener

Defines the IRemotingService reference of this remoting service.


Implementation
    public function get listener():IRemotingServiceListener
    public function set listener(value:IRemotingServiceListener):void
methodNameproperty 
public var methodName:String

Indicates the name of the server-side service's method.

multipleSimultaneousAllowedproperty 
public var multipleSimultaneousAllowed:Boolean

Defines if the service can lauch multiple simultaneous connections.

objectEncodingproperty 
public var objectEncoding:uint = 3.0

The object encoding (AMF version) for the internal NetConnection instance.

paramsproperty 
params:Array

Determinates the Array representation of all arguments to pass in the service method.


Implementation
    public function get params():Array
    public function set params(value:Array):void
proxyproperty 
proxy:RemotingServiceProxy  [read-only]

Determinates a RemotingServiceProxy of the current service to use simple methods to run remoting queries.


Implementation
    public function get proxy():RemotingServiceProxy
resultproperty 
result:Signal  [read-only]

This signal emit when the service receive a result with success.


Implementation
    public function get result():Signal
scopeproperty 
scope:String

The scope of this object ("prototype" or "singleton")


Implementation
    public function get scope():String
    public function set scope(value:String):void

See also

serviceNameproperty 
public var serviceName:String

Indicates the name of the server-side service.

timeoutPolicyproperty 
timeoutPolicy:TimeoutPolicy

Indicates the timeout policy value of this service. Use limit timeout interval.


Implementation
    public function get timeoutPolicy():TimeoutPolicy
    public function set timeoutPolicy(value:TimeoutPolicy):void

See also

TimeoutPolicy
Constructor Detail
RemotingService()Constructor
public function RemotingService(gatewayUrl:String = null, serviceName:String = null, methodName:String = null, params:Array = null)

Creates a new RemotingService instance.

Parameters
gatewayUrl:String (default = null) — The url of the gateway of the remoting service.
 
serviceName:String (default = null) — (optional) The name of the service in the server.
 
methodName:String (default = null) — (optional) The method name to invoke in the specific remoting service.
 
params:Array (default = null)
Method Detail
clone()method
override public function clone():*

Returns a shallow copy of this object.

Returns
* — a shallow copy of this object.
registerClassAlias()method 
public static function registerClassAlias(aliasName:String, classObject:Class):void

Preserves the class (type) of an object when the object is encoded in Action Message Format (AMF). When you encode an object into AMF, this function saves the alias for its class, so that you can recover the class when decoding the object. If the encoding context did not register an alias for an object's class, the object is encoded as an anonymous object. Similarly, if the decoding context does not have the same alias registered, an anonymous object is created for the decoded data. This static method is the same like the flash.net.registerClassAlias singleton method.

Parameters

aliasName:String
 
classObject:Class

run()method 
override public function run(... arguments):void

Run the process of the remoting service.

Parameters

... arguments

setCredentials()method 
public function setCredentials(authentification:RemotingAuthentification = null):void

Defines a set of credentials to be presented to the server on all subsequent requests.

Parameters

authentification:RemotingAuthentification (default = null) — The RemotingAuthentification instance to presented to the server.

See also

setDelay()method 
public function setDelay(time:uint, useSeconds:Boolean = false):void

Set timeout interval duration.

Parameters

time:uint — the delay value of the timeout event notification.
 
useSeconds:Boolean (default = false) — Indicates if the time value is in seconds true or milliseconds false.

toString()method 
public function toString():String

Returns the String representation of this object.

Returns
String — the String representation of this object.
Constant Detail
DEFAULT_DELAYConstant
public static const DEFAULT_DELAY:uint = 25000

The default delay value before notify the timeout event (25 seconds)

LEVEL_ERRORConstant 
public static const LEVEL_ERROR:String = error

The string representation value of the level error of the service.