View comments | RSS feed
Packagemx.rpc
Classpublic dynamic class AbstractService
InheritanceAbstractService Inheritance Proxy Inheritance Object
ImplementsIEventDispatcher
SubclassesRemoteObject, WebService

the AbstractService class is the base class for the WebService and RemoteObject classes. This class does the work of creating Operations which do the actual execution of remote procedure calls.



Public Properties
 PropertyDefined by
  channelSet : ChannelSet
Provides access to the ChannelSet used by the service.
AbstractService
 Inheritedconstructor : Object
A reference to the class object or constructor function for a given object instance.
Object
  destination : String
The destination of the service.
AbstractService
  operations : Object
The Operations array is usually only set by the MXML compiler if you create a service using an MXML tag.
AbstractService
 Inheritedprototype : Object
[static] A reference to the prototype object of a class or function object.
Object
  requestTimeout : int
Provides access to the request timeout in seconds for sent messages.
AbstractService
Public Methods
 MethodDefined by
  
AbstractService(destination:String = null)
AbstractService
  
Disconnects the service's network connection and removes any pending request responders.
AbstractService
  
Returns an Operation of the given name.
AbstractService
 Inherited
Indicates whether an object has a specified property defined.
Object
 Inherited
Indicates whether an instance of the Object class is in the prototype chain of the object specified as the parameter.
Object
  
Logs the user out of the destination.
AbstractService
 Inherited
Indicates whether the specified property exists and is enumerable.
Object
  
setCredentials(username:String, password:String):void
Set the credentials for the destination accessed by the service.
AbstractService
 Inherited
Sets the availability of a dynamic property for loop operations.
Object
  
setRemoteCredentials(remoteUsername:String, remotePassword:String):void
The username and password to be used to authenticate a user when accessing a remote, third-party endpoint such as a webservice through a proxy or a remote object through a custom adapter.
AbstractService
 Inherited
Returns the string representation of the specified object.
Object
 Inherited
Returns the primitive value of the specified object.
Object
Protected Methods
 MethodDefined by
 Inherited
callProperty(name:*, ... rest):*
Overrides the behavior of an object property that can be called as a function.
Proxy
 Inherited
Overrides the request to delete a property.
Proxy
 Inherited
Overrides the use of the descendant operator.
Proxy
 Inherited
getProperty(name:*):*
Overrides any request for a property's value.
Proxy
 Inherited
Overrides a request to check whether an object has a particular property by name.
Proxy
 Inherited
Checks whether a supplied QName is also marked as an attribute.
Proxy
 Inherited
Allows enumeration of the proxied object's properties by index number to retrieve property names.
Proxy
 Inherited
Allows enumeration of the proxied object's properties by index number.
Proxy
 Inherited
nextValue(index:int):*
Allows enumeration of the proxied object's properties by index number to retrieve property values.
Proxy
 Inherited
setProperty(name:*, value:*):void
Overrides a call to change a property's value.
Proxy
Events
 EventSummaryDefined by
   The fault event is dispatched when a service call fails and isn't handled by the Operation itself.AbstractService
   The invoke event is dispatched when a service Operation is invoked so long as an Error is not thrown before the Channel attempts to send the message.AbstractService
   The result event is dispatched when a service call successfully returns and isn't handled by the Operation itself.AbstractService
Property detail
channelSetproperty
channelSet:ChannelSet  [read-write]

Provides access to the ChannelSet used by the service. The ChannelSet can be manually constructed and assigned, or it will be dynamically created to use the configured Channels for the destination for this service.

This property can be used as the source for data binding.

Implementation
    public function get channelSet():ChannelSet
    public function set channelSet(value:ChannelSet):void
destinationproperty 
destination:String  [read-write]

The destination of the service. This value should match a destination entry in the services-config.xml file.

This property can be used as the source for data binding.

Implementation
    public function get destination():String
    public function set destination(value:String):void
operationsproperty 
operations:Object  [read-write]

The Operations array is usually only set by the MXML compiler if you create a service using an MXML tag.

This property can be used as the source for data binding.

Implementation
    public function get operations():Object
    public function set operations(value:Object):void
requestTimeoutproperty 
requestTimeout:int  [read-write]

Provides access to the request timeout in seconds for sent messages. A value less than or equal to zero prevents request timeout.

This property can be used as the source for data binding.

Implementation
    public function get requestTimeout():int
    public function set requestTimeout(value:int):void
Constructor detail
AbstractService()constructor
public function AbstractService(destination:String = null)Parameters
destination:String (default = null)
Method detail
disconnect()method
public function disconnect():void

Disconnects the service's network connection and removes any pending request responders. This method does not wait for outstanding network operations to complete.

getOperation()method 
public final function getOperation(name:String):AbstractOperation

Returns an Operation of the given name. If the Operation wasn't been created beforehand, it is created during this call. Operations are usually accessible by simply naming them after the service variable (myService.someOperation), but if your Operation name happens to match a defined method on the service (like setCredentials), you can use this method to get the Operation instead.

Parameters
name:String — Name of the Operation.

Returns
AbstractOperation — Operation that executes for this name.
logout()method 
public function logout():void

Logs the user out of the destination. Logging out of a destination applies to everything connected using the same ChannelSet as specified in the server configuration. For example, if you're connected over the my-rtmp channel and you log out using one of your RPC components, anything that was connected over the same ChannelSet is logged out.

setCredentials()method 
public function setCredentials(username:String, password:String):void

Set the credentials for the destination accessed by the service. The credentials are applied to all services connected over the same ChannelSet. Note that services that use a proxy or a third-party adapter to a remote endpoint will need to setRemoteCredentials instead.

Parameters
username:String — The username for the destination.
 
password:String — The password for the destination.
setRemoteCredentials()method 
public function setRemoteCredentials(remoteUsername:String, remotePassword:String):void

The username and password to be used to authenticate a user when accessing a remote, third-party endpoint such as a webservice through a proxy or a remote object through a custom adapter.

Parameters
remoteUsername:String — the username to pass to the remote endpoint
 
remotePassword:String — the password to pass to the remote endpoint
Event detail
faultevent 
Event object type: mx.rpc.events.FaultEvent
FaultEvent.type property = mx.rpc.events.FaultEvent.FAULT

The fault event is dispatched when a service call fails and isn't handled by the Operation itself.

The FAULT event type.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelabletrue, calling preventDefault() from the associated token's responder.fault method will prevent the service or operation from dispatching this event
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
faultThe Fault object that contains the details of what caused this event.
messageThe Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
tokenThe token that represents the call to the method. Used in the asynchronous completion token pattern.
invokeevent  
Event object type: mx.rpc.events.InvokeEvent
InvokeEvent.type property = mx.rpc.events.InvokeEvent.INVOKE

The invoke event is dispatched when a service Operation is invoked so long as an Error is not thrown before the Channel attempts to send the message.

The INVOKE event type.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
token The token that represents the indiviudal call to the method. Used in the asynchronous completion token pattern.
cancelabletrue
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
message The request Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
resultevent  
Event object type: mx.rpc.events.ResultEvent
ResultEvent.type property = mx.rpc.events.ResultEvent.RESULT

The result event is dispatched when a service call successfully returns and isn't handled by the Operation itself.

The RESULT event type.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelabletrue, preventDefault() from the associated token's responder.result method will prevent the service or operation from dispatching this event
currentTargetThe Object that defines the event listener that handles the event. For example, if you use myButton.addEventListener() to register an event listener, myButton is the value of the currentTarget.
message The Message associated with this event.
targetThe Object that dispatched the event; it is not always the Object listening for the event. Use the currentTarget property to always access the Object listening for the event.
resultResult that the RPC call returns.
tokenThe token that represents the indiviudal call to the method. Used in the asynchronous completion token pattern.




Comments


MarkEllul said on May 11, 2007 at 3:53 AM :
Could more information be given about the requestTimeout?

What happens if the service call times out? is the Fault Event called? Does nothing happen?

I am sure others apart from myself would find this useful

Thanks
smgilson said on May 14, 2007 at 12:04 PM :
When the requestTimeout is exceeded the pending call/send is faulted. This property is most useful when communicating with the server over Http, and ideally it's use should be restricted to HTTPService, WebService or RemoteObject calls. It's on DataService as well in the event that a user wanted to time out a long running fill.

In all cases, it's risky to use with non-idempotent operations (i.e. create/update/delete in DataService) because you won't know whether your request didn't make it to the server or made it to the server, got processed but the response was lost or slowed down in the network.

Set this to a higher value then the normal time it takes for a request roundtrip from their client application to the server and back.

Stephen Gilson
Flex Doc Team

 

RSS feed | Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/flex/2/langref/mx/rpc/AbstractService.html