web/lib/Zend/XmlRpc/Client.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    13  * to license@zend.com so we can send you a copy immediately.
    13  * to license@zend.com so we can send you a copy immediately.
    14  *
    14  *
    15  * @category   Zend
    15  * @category   Zend
    16  * @package    Zend_XmlRpc
    16  * @package    Zend_XmlRpc
    17  * @subpackage Client
    17  * @subpackage Client
    18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    18  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    20  * @version    $Id: Client.php 20096 2010-01-06 02:05:09Z bkarwin $
    20  * @version    $Id: Client.php 24593 2012-01-05 20:35:02Z matthew $
    21  */
    21  */
    22 
    22 
    23 
    23 
    24 /**
    24 /**
    25  * For handling the HTTP connection to the XML-RPC service
    25  * For handling the HTTP connection to the XML-RPC service
    69  * An XML-RPC client implementation
    69  * An XML-RPC client implementation
    70  *
    70  *
    71  * @category   Zend
    71  * @category   Zend
    72  * @package    Zend_XmlRpc
    72  * @package    Zend_XmlRpc
    73  * @subpackage Client
    73  * @subpackage Client
    74  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    74  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    75  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    75  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    76  */
    76  */
    77 class Zend_XmlRpc_Client
    77 class Zend_XmlRpc_Client
    78 {
    78 {
    79     /**
    79     /**
   209 
   209 
   210 
   210 
   211     /**
   211     /**
   212      * Returns a proxy object for more convenient method calls
   212      * Returns a proxy object for more convenient method calls
   213      *
   213      *
   214      * @param $namespace  Namespace to proxy or empty string for none
   214      * @param string $namespace  Namespace to proxy or empty string for none
   215      * @return Zend_XmlRpc_Client_ServerProxy
   215      * @return Zend_XmlRpc_Client_ServerProxy
   216      */
   216      */
   217     public function getProxy($namespace = '')
   217     public function getProxy($namespace = '')
   218     {
   218     {
   219         if (empty($this->_proxyCache[$namespace])) {
   219         if (empty($this->_proxyCache[$namespace])) {
   292 
   292 
   293         if ($response === null) {
   293         if ($response === null) {
   294             $response = new Zend_XmlRpc_Response();
   294             $response = new Zend_XmlRpc_Response();
   295         }
   295         }
   296         $this->_lastResponse = $response;
   296         $this->_lastResponse = $response;
   297         $this->_lastResponse->loadXml($httpResponse->getBody());
   297         $this->_lastResponse->loadXml(trim($httpResponse->getBody()));
   298     }
   298     }
   299 
   299 
   300     /**
   300     /**
   301      * Send an XML-RPC request to the service (for a specific method)
   301      * Send an XML-RPC request to the service (for a specific method)
   302      *
   302      *
   331                 );
   331                 );
   332 
   332 
   333                 if (!is_array($params)) {
   333                 if (!is_array($params)) {
   334                     $params = array($params);
   334                     $params = array($params);
   335                 }
   335                 }
   336                 foreach ($params as $key => $param) {
   336 
   337 
   337                 foreach ($params as $key => $param)
       
   338                 {
   338                     if ($param instanceof Zend_XmlRpc_Value) {
   339                     if ($param instanceof Zend_XmlRpc_Value) {
   339                         continue;
   340                         continue;
   340                     }
   341                     }
   341 
   342 
   342                     $type = Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
   343                     if (count($signatures) > 1) {
   343                     foreach ($signatures as $signature) {
   344                         $type = Zend_XmlRpc_Value::getXmlRpcTypeByValue($param);
   344                         if (!is_array($signature)) {
   345                         foreach ($signatures as $signature) {
   345                             continue;
   346                             if (!is_array($signature)) {
       
   347                                 continue;
       
   348                             }
       
   349                             if (isset($signature['parameters'][$key])) {
       
   350                                 if ($signature['parameters'][$key] == $type) {
       
   351                                     break;
       
   352                                 }
       
   353                             }
   346                         }
   354                         }
   347 
   355                     } elseif (isset($signatures[0]['parameters'][$key])) {
   348                         if (isset($signature['parameters'][$key])) {
   356                         $type = $signatures[0]['parameters'][$key];
   349                             $type = $signature['parameters'][$key];
   357                     } else {
   350                             $type = in_array($type, $validTypes) ? $type : Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
   358                         $type = null;
   351                         }
   359                     }
       
   360 
       
   361                     if (empty($type) || !in_array($type, $validTypes)) {
       
   362                         $type = Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
   352                     }
   363                     }
   353 
   364 
   354                     $params[$key] = Zend_XmlRpc_Value::getXmlRpcValue($param, $type);
   365                     $params[$key] = Zend_XmlRpc_Value::getXmlRpcValue($param, $type);
   355                 }
   366                 }
   356             }
   367             }