Service Class
Class com.probertson.xmlrpc.Service
Inheritance
>
ServiceBase
>
Service
Represents an XML-RPC service which provides one or more remote methods. This is the main
class used by end-developers to make remote method calls using XML-RPC. Developers should
create a Service instance, then call methods on the Service instance with names matching
the available remote methods.
Example
If an XML-RPC service named "animals" provides a method named "getSound"
(which would probably be commonly referred to as "animals.getSound"), the following lines
of code could be used to call the method and retrieve the result:
var animalService:com.probertson.xmlrpc.Service = new com.probertson.xmlrpc.Service("http://example.com/serviceURL", "animals", null, null);
var animalCall:mx.rpc.PendingCall = animalService.getSound("dog");
// assume other functions named "getSoundResult" and "getSoundFault" are defined.
// those functions will be called with the result (or if an error happens) respectively.
animalCall.responder = new com.probertson.rpc.RelayResponder2(this, getSoundResult, getSoundFault);
Constructor Summary |
---|
| Creates a new Service instance. |
Property Summary |
---|
Connection | |
String | Gets the name of the remote service which this instance "wraps." |
Responder | Gets the mx.rpc.Responder assigned to this instance, if one was assigned to it. |
Method Summary |
---|
protected PendingCall | Implementers should create their own mechanism for allowing access to the XML-RPC
service's methods (e.g. |
protected ServiceMethod | Implementers can use this method to get access to the {see com.probertson.xmlrpc.ServiceMethod} instance which will handle
a particular remote method call in order to make the remote call through the RemoteMethod instance
rather than through {link com.probertson.xmlrpc.ServiceBase#call}. |
Service
public function Service(serviceUri:String, serviceName:String, conn:
Connection, resp:Responder)
Creates a new Service instance.
Parameters:
serviceUri
- The fully qualified (including http/https) uri of the service. This
parameter is required unless a Connection is provided to the "conn"
parameter, in which case null should be passed.
serviceName
- The name of the XML-RPC service. Typically XML-RPC methods are referred
to with a two-part name (e.g. "math.sum", "math.difference"). The service
name is the first part of the method name, up to but not including the
period (e.g. "math"). If a remote method has a simple method name (i.e.
without a period) just pass null for this parameter, and any methods
at the service uri with no "service name" will be available to this instance.
conn
- A
Connection Class
instance (which will
have a service uri already defined) to be used by this instance.
Under most circumstances this parameter should be passed null. resp
- A mx.rpc.Responder instance specifying result and fault methods
to be used for all remote method calls through this service.
Generally, those are specified through the
PendingCall.responder
property of the PendingCall Class
instance returned
by the Service method which wraps the remote call, so this paramater
will commonly be passed null.
name
public function get name():String
Gets the name of the remote service which this instance "wraps."
responder
public function get responder():Responder
Gets the mx.rpc.Responder assigned to this instance, if one was assigned to it.
call
protected function call(methodName:String):PendingCall
Implementers should create their own mechanism for allowing access to the XML-RPC
service's methods (e.g. a wrapper method). Your subclass should call
this method to actually perform the remote method call.
this method.
Parameters:
methodName
- The name of the remote method to call.
[param1...paramN]
- The parameters to be passed to the remote method. These can be any of
the allowed XML-RPC types.
getServiceMethod
protected function getServiceMethod(methodName:String):
ServiceMethodImplementers can use this method to get access to the {see com.probertson.xmlrpc.ServiceMethod} instance which will handle
a particular remote method call in order to make the remote call through the RemoteMethod instance
rather than through {link com.probertson.xmlrpc.ServiceBase#call}. For most cases ServiceBase.call() will suffice.
The most common reason you might want to get access to the ServiceMethod would be to pass the
method parameters as an array rather than as separate parameters.
Parameters:
methodName
- The name of the remote method whose respective ServiceMethod instance
should be returned.
Documentation generated by BLDoc Community Edition from B-Line Express.