当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_XmlRpc_Response::isFault方法代码示例

本文整理汇总了PHP中Zend_XmlRpc_Response::isFault方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_XmlRpc_Response::isFault方法的具体用法?PHP Zend_XmlRpc_Response::isFault怎么用?PHP Zend_XmlRpc_Response::isFault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_XmlRpc_Response的用法示例。


在下文中一共展示了Zend_XmlRpc_Response::isFault方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parse

 /**
  * {@inheritdoc}
  */
 public function parse($xmlString)
 {
     $response = new \Zend_XmlRpc_Response();
     try {
         $response->loadXml($xmlString);
     } catch (\Exception $e) {
         throw new ParserException($e->getMessage(), $e->getCode(), $e);
     }
     if ($response->isFault()) {
         $fault = $response->getFault();
         throw new FaultException($fault->getMessage(), $fault->getCode());
     }
     $result = $response->getReturnValue();
     $toBeVisited = [&$result];
     while (isset($toBeVisited[0]) && ($value =& $toBeVisited[0])) {
         $type = gettype($value);
         if ($type === 'array') {
             foreach ($value as &$element) {
                 $toBeVisited[] =& $element;
             }
             reset($value);
             // Reset all array pointers
         }
         array_shift($toBeVisited);
     }
     return $result;
 }
开发者ID:fxmlrpc,项目名称:serialization,代码行数:30,代码来源:Zend1Parser.php

示例2: call

 /**
  * Send an XML-RPC request to the service (for a specific method)
  *
  * @param string $method Name of the method we want to call
  * @param array $params Array of parameters for the method
  * @throws Zend_Http_Client_FaultException
  */
 public function call($method, $params = array())
 {
     //        if ('system.' != substr($method, 0, 7)) {
     //
     //            // Ensure empty array/struct params are cast correctly
     //
     //            $signatures = $this->getIntrospector()->getMethodSignature($method);
     //            foreach ($params as $key => $param) {
     //                if (is_array($param) && empty($param)) {
     //                    $type = 'array';
     //                    foreach ($signatures as $signature) {
     //                        if (!is_array($signature)) {
     //                            continue;
     //                        }
     //                        if (array_key_exists($key + 1, $signature)) {
     //                            $type = $signature[$key + 1];
     //                            $type = (in_array($type, array('array', 'struct'))) ? $type : 'array';
     //                            break;
     //                        }
     //                    }
     //                    $params[$key] = array(
     //                        'type'  => $type,
     //                        'value' => $param
     //                    );
     //                }
     //            }
     //        }
     $request = new Zend_XmlRpc_Request($method, $params);
     $this->doRequest($request);
     if ($this->_lastResponse->isFault()) {
         $fault = $this->_lastResponse->getFault();
         throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode());
     }
     return $this->_lastResponse->getReturnValue();
 }
开发者ID:villos,项目名称:tree_admin,代码行数:42,代码来源:Client.php

示例3: testLoadXmlThrowsExceptionWithMissingNodes3

 public function testLoadXmlThrowsExceptionWithMissingNodes3()
 {
     $sxl = new \SimpleXMLElement('<?xml version="1.0"?><methodResponse><bar>foo</bar></methodResponse>');
     $this->assertFalse($this->_response->loadXml($sxl->asXML()));
     $this->assertTrue($this->_response->isFault());
     $fault = $this->_response->getFault();
     $this->assertEquals(652, $fault->getCode());
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:8,代码来源:ResponseTest.php

示例4: call

 /**
  * Send an XML-RPC request to the service (for a specific method)
  * 
  * @param string $method Name of the method we want to call
  * @param array $params Array of parameters for the method
  * @throws Zend_Http_Client_FaultException
  */
 public function call($method, $params = array())
 {
     $request = new Zend_XmlRpc_Request($method, $params);
     $this->doRequest($request);
     if ($this->_lastResponse->isFault()) {
         $fault = $this->_lastResponse->getFault();
         throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode());
     }
     return $this->_lastResponse->getReturnValue();
 }
开发者ID:josephholsten,项目名称:swaplady,代码行数:17,代码来源:Client.php

示例5: call

 /**
  * Send an XML-RPC request to the service (for a specific method)
  * 
  * @param string $method Name of the method we want to call
  * @param array $params Array of parameters for the method
  * @param boolean $asResponseObject Return it as a response object instead of PHP native?
  * @throws Zend_Http_Client_FaultException
  */
 public function call($method, $params = array(), $asResponseObject = false)
 {
     $request = new Zend_XmlRpc_Request();
     $request->setMethod($method);
     $request->setParams($params);
     $this->doRequest($request);
     if ($asResponseObject) {
         return $this->_lastResponse;
     } else {
         if ($this->_lastResponse->isFault()) {
             $fault = $this->_lastResponse->getFault();
             throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode());
         }
         return $this->_lastResponse->getReturnValue();
     }
 }
开发者ID:BackupTheBerlios,项目名称:openpublisher-svn,代码行数:24,代码来源:Client.php

示例6: call

 /**
  * Send an XML-RPC request to the service (for a specific method)
  *
  * @param string $method Name of the method we want to call
  * @param array $params Array of parameters for the method
  * @throws Zend_Http_Client_FaultException
  */
 public function call($method, $params = array())
 {
     if ('system.' != substr($method, 0, 7)) {
         // Ensure empty array/struct params are cast correctly
         // If system.* methods are not available, bypass. (ZF-2978)
         $success = true;
         try {
             $signatures = $this->getIntrospector()->getMethodSignature($method);
         } catch (Zend_XmlRpc_Exception $e) {
             $success = false;
         }
         if ($success) {
             foreach ($params as $key => $param) {
                 if (is_array($param) && empty($param)) {
                     $type = 'array';
                     foreach ($signatures as $signature) {
                         if (!is_array($signature)) {
                             continue;
                         }
                         if (array_key_exists($key + 1, $signature)) {
                             $type = $signature[$key + 1];
                             $type = in_array($type, array('array', 'struct')) ? $type : 'array';
                             break;
                         }
                     }
                     $params[$key] = array('type' => $type, 'value' => $param);
                 }
             }
         }
     }
     $request = new Zend_XmlRpc_Request($method, $params);
     $this->doRequest($request);
     if ($this->_lastResponse->isFault()) {
         $fault = $this->_lastResponse->getFault();
         throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode());
     }
     return $this->_lastResponse->getReturnValue();
 }
开发者ID:jon9872,项目名称:zend-framework,代码行数:45,代码来源:Client.php

示例7: call

 /**
  * Send an XML-RPC request to the service (for a specific method)
  *
  * @param  string $method Name of the method we want to call
  * @param  array $params Array of parameters for the method
  * @return mixed
  * @throws Zend_XmlRpc_Client_FaultException
  */
 public function call($method, $params = array())
 {
     if (!$this->skipSystemLookup() && 'system.' != substr($method, 0, 7)) {
         // Ensure empty array/struct params are cast correctly
         // If system.* methods are not available, bypass. (ZF-2978)
         $success = true;
         try {
             $signatures = $this->getIntrospector()->getMethodSignature($method);
         } catch (Zend_XmlRpc_Exception $e) {
             $success = false;
         }
         if ($success) {
             $validTypes = array(Zend_XmlRpc_Value::XMLRPC_TYPE_ARRAY, Zend_XmlRpc_Value::XMLRPC_TYPE_BASE64, Zend_XmlRpc_Value::XMLRPC_TYPE_BOOLEAN, Zend_XmlRpc_Value::XMLRPC_TYPE_DATETIME, Zend_XmlRpc_Value::XMLRPC_TYPE_DOUBLE, Zend_XmlRpc_Value::XMLRPC_TYPE_I4, Zend_XmlRpc_Value::XMLRPC_TYPE_INTEGER, Zend_XmlRpc_Value::XMLRPC_TYPE_NIL, Zend_XmlRpc_Value::XMLRPC_TYPE_STRING, Zend_XmlRpc_Value::XMLRPC_TYPE_STRUCT);
             if (!is_array($params)) {
                 $params = array($params);
             }
             foreach ($params as $key => $param) {
                 if ($param instanceof Zend_XmlRpc_Value) {
                     continue;
                 }
                 $type = Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
                 foreach ($signatures as $signature) {
                     if (!is_array($signature)) {
                         continue;
                     }
                     if (isset($signature['parameters'][$key])) {
                         $type = $signature['parameters'][$key];
                         $type = in_array($type, $validTypes) ? $type : Zend_XmlRpc_Value::AUTO_DETECT_TYPE;
                     }
                 }
                 $params[$key] = Zend_XmlRpc_Value::getXmlRpcValue($param, $type);
             }
         }
     }
     $request = $this->_createRequest($method, $params);
     $this->doRequest($request);
     if ($this->_lastResponse->isFault()) {
         $fault = $this->_lastResponse->getFault();
         /**
          * Exception thrown when an XML-RPC fault is returned
          * @see Zend_XmlRpc_Client_FaultException
          */
         #require_once 'Zend/XmlRpc/Client/FaultException.php';
         throw new Zend_XmlRpc_Client_FaultException($fault->getMessage(), $fault->getCode());
     }
     return $this->_lastResponse->getReturnValue();
 }
开发者ID:blazeriaz,项目名称:youguess,代码行数:55,代码来源:Client.php

示例8: testLoadXmlWithInvalidValue

 public function testLoadXmlWithInvalidValue()
 {
     $this->assertFalse($this->_response->loadXml(new \stdClass()));
     $this->assertTrue($this->_response->isFault());
     $this->assertSame(650, $this->_response->getFault()->getCode());
 }
开发者ID:rmarshall-quibids,项目名称:zf2,代码行数:6,代码来源:ResponseTest.php

示例9: testIsFault

 /**
  * isFault() test
  *
  * Call as method call 
  *
  * Returns: boolean 
  */
 public function testIsFault()
 {
     $this->assertFalse($this->_response->isFault());
     $this->_response->loadXml('foo');
     $this->assertTrue($this->_response->isFault());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:13,代码来源:ResponseTest.php


注:本文中的Zend_XmlRpc_Response::isFault方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。