## Zend_XmlRpc_Client

Description

An XML-RPC client implementation

- license: New BSD License
- copyright: Copyright (c) 2006 Zend Technologies USA Inc. (http://www.zend.com)

Located in /Zend/XmlRpc/Client.php (line 54)

Class Constant Summary
RESPONSE_PHP_NATIVE = 'php_native'
RESPONSE_XML_STRING = 'xml_string'
RESPONSE_ZXMLRPC_OBJECT = 'Zend_XmlRpc_Value_object'
Variable Summary
Zend_Http_client_Abstract $_httpClient
array $_methodSignatures
array $_namespaceDecorators
Zend_XmlRpc_Value|null $_response
string $_serverAddress
Method Summary
Zend_XmlRpc_Client __construct (string $server, [string $methodsXml = null])
string _buildMethodsXML (array $signatures)
string _buildRequest (string $method, [array $params = null])
array|null _convertParams ( &$params, [string $methodName = null], array $params)
array _getMethodParams (string $methodName)
void _parseResponse (string $response)
void _sendRequest (string $method, [array $params = null])
void __call (string $methodName, array $params)
Zend_XmlRpc_Client_NamespaceDecorator __get (string $namespace)
Zend_Http_Client_Abstract __getHttpClient ()
string __getMethodsXml ()
mixed __getResponse ([Zend_XmlRpc_Client::RESPONSE_* $type = self::RESPONSE_PHP_NATIVE])
void __setHttpClient ( $httpClient)
void __setMethodsXml ([null|string $methodsXml = null])
void __xmlrpcCall (string $methodName, varargs 1)
Variables
Zend_Http_client_Abstract $_httpClient = null (line 75)

The HTTP client object to use for connecting the XML-RPC server.

- access: protected

array $_methodSignatures = array() (line 102)

Holding all the method signatures, the array has the methods name as keys and the signature as the value

The signature is an array of 2 keys: 'return_value' - string, hold the return value of the method 'params' - array of strings, hold the parameters for the method (can be an empty array)

This array is created automatically when calling the __getMethodsXml() or __setMethodsXml() methods

- access: protected

array $_namespaceDecorators = array() (line 89)

Array of cached namespace decorators, array of Zend_XmlRpc_Client_NamespaceDecorator objects

- access: protected

Zend_XmlRpc_Value|null $_response = null (line 82)

The response from an XML-RPC method call, held in a Zend_XmlRpc_Value object

- access: protected

string $_serverAddress (line 68)

The XML-RPC service server full address

- access: protected

Methods
Constructor __construct (line 115)

Class constructor - create a new XML-RPC client to a remote server

- access: public

Zend_XmlRpc_Client __construct (string $server, [string $methodsXml = null])

- string $server: Full address of the XML-RPC service (e.g. http://time.xmlrpc.com/RPC2)
- string $methodsXml: Method signatures in XML format, used for type hinting during the PHP->XMLRPC type conversions. {@see __getMethodsXml() for more information}

_buildMethodsXML (line 509)

Generates an XML string analogous to SOAP's WSDL representing all the methods signatures Signature is the method return value and method parameters This function also set the _methodSignatures data memeber with the method signatures details (in an array)

- return: XML representing the signatures of all server methods, analogous to SOAP's WSDL file
- access: protected

string _buildMethodsXML (array $signatures)

- array $signatures: Array in the structure of method name => array (return value, parameters)

_buildRequest (line 363)

Build the XML body of an XML-RPC request

- return: The XML body
- access: protected

string _buildRequest (string $method, [array $params = null])

- string $method: Name of the method we want to call
- array $params: Array of Zend_XmlRpc_Value objects, parameters for the method

_convertParams (line 559)

Convert an array of PHP variables into XML-RPC native types represented by Zend_XmlRpc_Value objects If method name is given, try to use the _methodSignatures data member for type hinting, if not, auto convert the PHP variable types into XML-RPC types

- return: Array of Zend_XmlRpc_Value objects
- access: protected

array|null _convertParams ( &$params, [string $methodName = null], array $params)

- array $params: Array of PHP varaibles and/or Zend_XmlRpc_Value objects The parameter is passed by reference
- string $methodName: If set, the type hinting will be according to the parameters of this method
- &$params

_getMethodParams (line 592)

Return the XML-RPC types of the necessary parameters for a method in the service Get the types from the _methodSignatures data member {@see __getMethodsXml() for more information}

- return: XML-RPC types of the method parameters (or an empty array if there are no parameters)
- access: protected

array _getMethodParams (string $methodName)

- string $methodName

_parseResponse (line 395)

Parse the response from a XML-RPC method call, hold the response as a Zend_XmlRpc_Value object The response parameter must be a valid XML string

- access: protected

void _parseResponse (string $response)

- string $response: XML string to parse

_sendRequest (line 337)

Send a XML-RPC request to the service (for a specific method)

- access: protected
- throws: Zend_Http_Client_Exception

void _sendRequest (string $method, [array $params = null])

- string $method: Name of the method we want to call
- array $params: Array of Zend_XmlRpc_Value objects, parameters for the method

__call (line 145)

Using the magic __call function to call methods directly by method name

- access: public

void __call (string $methodName, array $params)

- string $methodName: The method we call from the service
- array $params: Array of parameters for the method call

__get (line 129)

Undefined properties are assumed to be XML-RPC namespaces and return a decorator to enable object chains.

- access: public

Zend_XmlRpc_Client_NamespaceDecorator __get (string $namespace)

- string $namespace

__getHttpClient (line 320)

Gets the HTTP client object.

- access: protected

Zend_Http_Client_Abstract __getHttpClient ()
__getMethodsXml (line 179)

Generates an XML string containing the signatures for every method on the remote server by calling system.listMethods() and then calling system.methodSignature() for each method. This output generated is analogous to SOAP's WSDL file.

- return: XML representing the signatures of all server methods, analogous to SOAP's WSDL file
- access: public

string __getMethodsXml ()
__getResponse (line 281)

The response received from the method call, response can be retrieved in 3 formats:

- as a PHP varaible,
- as XML string,
- or in the Zend_XmpRpc_Value object

- return: The response of the service
- access: public

mixed __getResponse ([Zend_XmlRpc_Client::RESPONSE_* $type = self::RESPONSE_PHP_NATIVE])

- Zend_XmlRpc_Client::RESPONSE_* $type: The response value types, options are: PHP native type, original XML string or Zend_XmlRpc_Value object

__setHttpClient (line 309)

Sets the HTTP client object to use for connecting the XML-RPC server.

If none is set, the a default Zend_Http_Client will be used.

- access: public

void __setHttpClient ( $httpClient)

- Zend_Http_Client_Abstract $httpClient

__setMethodsXml (line 216)

Consumes an XML string generated by __getMethodsXml() and uses it for type hinting. When a remote method is called, either trapped by __call() or called with __xmlRpcCall(),

- access: public

void __setMethodsXml ([null|string $methodsXml = null])

- null|string $methodsXml: Use null for clearing the current method signatures

__xmlrpcCall (line 162)

Call a specific method (with or without parameters) from the XML-RPC service

- access: public

void __xmlrpcCall (string $methodName, varargs 1)

- string $methodName: The method we call from the service
- varargs 1: Optional, Parameters to pass the method, multiple (using func_get_args() function) parameter of native PHP types or Zend_XmlRpc_Value objects

Class Constants
RESPONSE_PHP_NATIVE = 'php_native' (line 59)

Different types for the response: as PHP native types, original XML or in Zend_XmlRpc_Value object

RESPONSE_XML_STRING = 'xml_string' (line 60)
RESPONSE_ZXMLRPC_OBJECT = 'Zend_XmlRpc_Value_object' (line 61)

Documentation generated on Tue, 11 Jul 2006 12:16:40 -0500 by phpDocumentor 1.3.0RC6