Creates a new instance of the Ripcord server.
Ripcord_Server
__construct
([ $services = null], [ $options = null], [ $documentor = null], mixed $services., array $options.)
-
mixed
$services.: Optional. An object or array of objects. The public methods in these objects will be exposed through the RPC server. If the services array has non-numeric keys, the key for each object will define its namespace.
-
array
$options.: Optional. Allows you to override the default server settings. Accepted key names are:
- 'documentor': allows you to specify an alternative HTML documentor class, or if set to false, no HTML documentor.
- 'name' : The name of the server, used by the default HTML documentor.
- 'css' : An url of a css file to link to in the HTML documentation.
- 'wsdl' : The wsdl 1.0 description of this service (only usefull if you run the 'soap 1.1' version, or the 'auto' version
- 'wsdl2' : The wsdl 2.0 description of this service
In addition you can set any of the outputOptions for the xmlrpc server.
-
$services
-
$options
-
$documentor
Allows you to add a single method to the server after construction.
void
addMethod
(string $name, callback $method)
-
string
$name: The name of the method as exposed through the rpc server
-
callback
$method: The name of the method to call, or an array with classname or object and method name.
Allows you to add a service to the server after construction.
void
addService
(object $service, [string $serviceName = 0])
-
object
$service: The object or class whose public methods must be added to the rpc server. May also be a function or method.
-
string
$serviceName: Optional. The namespace for the methods.
Calls a method by its rpc name.
mixed
call
(string $method, [array $args = null])
-
string
$method: The rpc name of the method
-
array
$args: The arguments to this method
Handles the given request xml
string
handle
(string $request_xml)
-
string
$request_xml: The incoming request.
Runs the rpc server. Automatically handles an incoming request.
void
run
()
Allows you to set specific output options of the server after construction.
void
setOutputOption
(string $option, mixed $value)
-
string
$option: The name of the option
-
mixed
$value: The value of the option The options are:
- output_type: Return data as either php native data or xml encoded. Can be either 'php' or 'xml'. 'xml' is the default.
- verbosity: Determines the compactness of generated xml. Can be either 'no_white_space', 'newlines_only' or 'pretty'.
'pretty' is the default.
- escaping: Determines how/whether to escape certain characters. 1 or more values are allowed. If multiple, they need
to be specified as a sub-array. Options are: 'cdata', 'non-ascii', 'non-print' and 'markup'. Default is 'non-ascii',
'non-print' and 'markup'.
- version: Version of the xml vocabulary to use. Currently, three are supported: 'xmlrpc', 'soap 1.1' and 'simple'. The
keyword 'auto' is also recognized and tells the server to respond in whichever version the request cam in. 'auto' is
the default.
- encoding: The character encoding that the data is in. Can be any supported character encoding. Default is 'utf-8'.