Class Horde_Rpc
The Horde_Rpc:: class provides a set of server and client methods for
RPC communication.
TODO:
- Introspection documentation and method signatures.
EXAMPLE:
$response = Horde_Rpc::request('xmlrpc',
'http://localhost:80/horde/rpc.php',
'contacts.search',
$transport_client,
array(array('jan'), array('localsql'),
array('name', 'email')));
Copyright 2002-2012 Horde LLC (http://www.horde.org/)
See the enclosed file COPYING for license information (LGPL). If you
did not receive this file, see http://www.horde.org/licenses/lgpl21.
Methods summary
public
Horde_Rpc
|
#
__construct( Horde_Controller_Request_Http $request, array $params = array() )
RPC server constructor.
Parameters
- $request
- request object
- $params
- <p>A hash containing any additional configuration or
connection parameters a subclass might need.</p>
Returns
|
public
boolean
|
#
authorize( )
Check authentication. Different backends may handle
authentication in different ways. The base class implementation
checks for HTTP Authentication against the Horde auth setup.
Check authentication. Different backends may handle
authentication in different ways. The base class implementation
checks for HTTP Authentication against the Horde auth setup.
Returns
boolean Returns true if authentication is successful.
Should send appropriate "not authorized" headers
or other response codes/body if auth fails,
and take care of exiting.
|
public
mixed
|
#
getInput( )
Get the request body input. Different RPC backends can override
this to return an open stream to php://stdin, for instance -
whatever is easiest to handle in the getResponse() method.
Get the request body input. Different RPC backends can override
this to return an open stream to php://stdin, for instance -
whatever is easiest to handle in the getResponse() method.
The base class implementation looks for $HTTP_RAW_POST_DATA and
returns that if it's available; otherwise, it returns the
contents of php://stdin.
Returns
mixed The input - a string (default), a filehandle, etc.
|
public
string
|
#
getResponse( string $request )
Sends an RPC request to the server and returns the result.
Sends an RPC request to the server and returns the result.
Parameters
- $request
- raw request string.
Returns
string The XML encoded response from the server.
|
public
string
|
#
getResponseContentType( )
Returns the Content-Type of the response.
Returns the Content-Type of the response.
Returns
string The MIME Content-Type of the RPC response.
|
public
|
#
sendOutput( string $output )
Send the output back to the client
Send the output back to the client
Parameters
- $output
- <p>The output to send back to the client. Can be
overridden in classes if needed.</p>
|
public static
mixed
|
#
request( string $driver, string|Horde_Url $url, string $method, mixed $client, array $params = null )
Builds an RPC request and sends it to the RPC server.
Builds an RPC request and sends it to the RPC server.
This statically called method is actually the RPC client.
Parameters
- $driver
- <p>The protocol driver to use. Currently
'soap', 'xmlrpc' and 'jsonrpc' are
available.</p>
- $url
- <p>The path to the RPC server on the called
host.</p>
- $method
- The method to call.
- $client
- <p>An appropriate request client for the type
of request. (Horde_Http_Request, SoapClient
etc..)</p>
- $params
- <p>A hash containing any necessary parameters
for the method call.</p>
Returns
mixed The returned result from the method
Throws
|
public static
Horde_Rpc
|
#
factory( mixed $driver, array $request, mixed $params = null )
Attempts to return a concrete RPC server instance based on
$driver.
Attempts to return a concrete RPC server instance based on
$driver.
Parameters
- $driver
- The type of concrete Horde_Rpc subclass to return.
- $request
- <p>$params A hash containing any additional configuration or
connection parameters a subclass might need.</p>
- $params
-
Returns
Horde_Rpc
The newly created concrete Horde_Rpc server instance,
or an exception if there is an error.
|
Properties summary
public
array
|
$_params
All driver-specific parameters.
All driver-specific parameters.
|
|
public
boolean
|
$_requireAuthorization
Do we need an authenticated user?
Do we need an authenticated user?
|
|
public
boolean
|
$_requestMissingAuthorization
Whether we should exit if auth fails instead of requesting
authorization credentials.
Whether we should exit if auth fails instead of requesting
authorization credentials.
|
|