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


PHP Zend_XmlRpc_Request::setParams方法代码示例

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


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

示例1: test__toString

 /**
  * __toString() test
  */
 public function test__toString()
 {
     $argv = array('string', true);
     $this->_request->setMethod('do.Something');
     $this->_request->setParams($argv);
     $xml = $this->_request->__toString();
     try {
         $sx = new SimpleXMLElement($xml);
     } catch (Exception $e) {
         $this->fail('Invalid XML returned');
     }
     $result = $sx->xpath('//methodName');
     $count = 0;
     while (list(, $node) = each($result)) {
         ++$count;
     }
     $this->assertEquals(1, $count, $xml);
     $result = $sx->xpath('//params');
     $count = 0;
     while (list(, $node) = each($result)) {
         ++$count;
     }
     $this->assertEquals(1, $count, $xml);
     try {
         $methodName = (string) $sx->methodName;
         $params = array((string) $sx->params->param[0]->value->string, (bool) $sx->params->param[1]->value->boolean);
     } catch (Exception $e) {
         $this->fail('One or more inconsistencies parsing generated XML: ' . $e->getMessage());
     }
     $this->assertEquals('do.Something', $methodName);
     $this->assertSame($argv, $params, $xml);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:35,代码来源:RequestTest.php

示例2: test__toString

 /**
  * __toString() test
  */
 public function test__toString()
 {
     $argv = array('string', true);
     $this->_request->setMethod('do.Something');
     $this->_request->setParams($argv);
     $xml = $this->_request->__toString();
     $this->_testXmlRequest($xml, $argv);
 }
开发者ID:navassouza,项目名称:zf2,代码行数:11,代码来源:RequestTest.php

示例3: testHandleFunction

 public function testHandleFunction()
 {
     $this->_server->addFunction('Zend_XmlRpc_Server_testFunction');
     $request = new Zend_XmlRpc_Request();
     $request->setMethod('Zend_XmlRpc_Server_testFunction');
     $request->setParams(array(array('value1'), 'key'));
     $response = $this->_server->handle($request);
     $this->assertFalse($response instanceof Zend_XmlRpc_Fault);
     $this->assertEquals('key: value1', $response->getReturnValue());
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:10,代码来源:ServerTest.php

示例4: multicall

 /**
  * Multicall - boxcar feature of XML-RPC for calling multiple methods
  * in a single request.
  *
  * Expects a an array of structs representing method calls, each element
  * having the keys:
  * - methodName
  * - params
  *
  * Returns an array of responses, one for each method called, with the value
  * returned by the method. If an error occurs for a given method, returns a
  * struct with a fault response.
  *
  * @see http://www.xmlrpc.com/discuss/msgReader$1208
  * @param  array $methods
  * @return array
  */
 public function multicall($methods)
 {
     $responses = array();
     foreach ($methods as $method) {
         $fault = false;
         if (!is_array($method)) {
             $fault = $this->_server->fault('system.multicall expects each method to be a struct', 601);
         } elseif (!isset($method['methodName'])) {
             $fault = $this->_server->fault('Missing methodName: ' . var_export($methods, 1), 602);
         } elseif (!isset($method['params'])) {
             $fault = $this->_server->fault('Missing params', 603);
         } elseif (!is_array($method['params'])) {
             $fault = $this->_server->fault('Params must be an array', 604);
         } else {
             if ('system.multicall' == $method['methodName']) {
                 // don't allow recursive calls to multicall
                 $fault = $this->_server->fault('Recursive system.multicall forbidden', 605);
             }
         }
         if (!$fault) {
             try {
                 $request = new Zend_XmlRpc_Request();
                 $request->setMethod($method['methodName']);
                 $request->setParams($method['params']);
                 $response = $this->_server->handle($request);
                 if ($response instanceof Zend_XmlRpc_Fault || $response->isFault()) {
                     $fault = $response;
                 } else {
                     $responses[] = $response->getReturnValue();
                 }
             } catch (Exception $e) {
                 $fault = $this->_server->fault($e);
             }
         }
         if ($fault) {
             $responses[] = array('faultCode' => $fault->getCode(), 'faultString' => $fault->getMessage());
         }
     }
     return $responses;
 }
开发者ID:SalesOneGit,项目名称:s1_magento,代码行数:57,代码来源:System.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: microtime

$request = null;
$serializer = null;
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
    $request = new Zend\XmlRpc\Request();
    $request->setMethod('test');
    $request->setParams($args);
    $r = $request->saveXml();
}
$end = microtime(true);
printf("Zend\\XmlRpc\\Request (ZF2): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
    $request = new Zend_XmlRpc_Request();
    $request->setMethod('test');
    $request->setParams($args);
    $r = $request->saveXml();
}
$end = microtime(true);
printf("Zend_XmlRpc_Request (ZF1): %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
    $serializer = new fXmlRpc\Serializer\XmlWriterSerializer();
    $r = $serializer->serialize('test', $args);
}
$end = microtime(true);
printf("fXmlRpc\\Serializer\\XmlWriterSerializer: %s sec for %d passes\n", $end - $start, $limit);
$start = microtime(true);
for ($a = 0; $a < $limit; ++$a) {
    $serializer = new fXmlRpc\Serializer\NativeSerializer();
    $r = $serializer->serialize('test', $args);
开发者ID:Banjerr,项目名称:infusionWholesaler,代码行数:31,代码来源:serializer.php


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