Class Zend_XmlRpc_Client

Description

An XML-RPC client implementation

Located in /library/Zend/XmlRpc/Client.php (line 45)


	
			
Class Constant Summary
 RESPONSE_PHP_NATIVE = 'php_native'
 RESPONSE_XML_STRING = 'xml_string'
 RESPONSE_ZXMLRPC_OBJECT = 'Zend_XmlRpc_Value_object'
Variable Summary
Method Summary
 Zend_XmlRpc_Client __construct (string $server, [string $namespace = null], [string $methodsXml = null])
 string _buildMethodsXML (array $signatures)
 string _buildRequest (string $method, [array $params = null])
 array|null _convertParams (array &$params, [string $methodName = null])
 array _getMethodParams (string $methodName)
 void _parseResponse (string $response)
 void _sendRequest (string $method, [array $params = null])
 void __call (string $methodName, array $params)
 string __getMethodsXml ()
 string|null __getNamespace ()
 mixed __getResponse ([Zend_XmlRpc_Client::RESPONSE_* $type = self::RESPONSE_PHP_NATIVE])
 void __setMethodsXml ([null|string $methodsXml = null])
 void __setNamespace ([string|null $namespace = null])
 void __xmlrpcCall (string $methodName, varargs 1)
Variables
array $_methodSignatures = array() (line 87)

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
string|null $_namespace = null (line 74)

The default namespace to prepend to method names. The namespace is only prepended if the name of the method calls does not contain the namespace separator (a period).

  • access: protected
Zend_XmlRpc_Value|null $_response = null (line 66)

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

  • access: protected
string $_serverAddress (line 59)

The XML-RPC service server full address

  • access: protected
Methods
Constructor __construct (line 103)

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

  • access: public
Zend_XmlRpc_Client __construct (string $server, [string $namespace = null], [string $methodsXml = null])
  • string $server: Full address of the XML-RPC service (e.g. http://time.xmlrpc.com/RPC2)
  • string $namespace: The default namespace to be prepended to method calls that do not specify a namespace, or null.
  • string $methodsXml: Method signatures in XML format, used for type hinting during the PHP->XMLRPC type conversions. {@see __getMethodsXml() for more information}
_buildMethodsXML (line 479)

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 333)

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 529)

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 (array &$params, [string $methodName = null])
  • 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
_getMethodParams (line 562)

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 365)

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 313)

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

  • access: protected
  • throws: Zend_HttpClient_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 117)

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
__getMethodsXml (line 182)

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 ()
__getNamespace (line 169)

Returns the default namespace or null if there is not one.

  • access: public
string|null __getNamespace ()
__getResponse (line 284)

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
__setMethodsXml (line 219)

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
__setNamespace (line 153)

Sets the default namespace for XML-RPC calls. When a method call is made and the name of the method does not contain a period, the default namespace will be prepended to the method name if one was set.

  • access: public
void __setNamespace ([string|null $namespace = null])
  • string|null $namespace: If null, it will overwrite existing namespace
__xmlrpcCall (line 139)

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 50)

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

RESPONSE_XML_STRING = 'xml_string' (line 51)
RESPONSE_ZXMLRPC_OBJECT = 'Zend_XmlRpc_Value_object' (line 52)

Documentation generated on Wed, 08 Mar 2006 04:51:16 -0800 by phpDocumentor 1.3.0RC4