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


PHP Zend_XmlRpc_Server::handle方法代码示例

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


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

示例1: run

 /**
  * This is the XML-RPC server routine
  *
  * @access public
  * @return void
  */
 public function run()
 {
     Yii::import('application.helpers.remotecontrol.*');
     $oHandler = new remotecontrol_handle($this->controller);
     $RPCType = Yii::app()->getConfig("RPCInterface");
     if (Yii::app()->getRequest()->isPostRequest) {
         if ($RPCType == 'xml') {
             $cur_path = get_include_path();
             set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers');
             // Yii::import was causing problems for some odd reason
             require_once 'Zend/XmlRpc/Server.php';
             require_once 'Zend/XmlRpc/Server/Exception.php';
             require_once 'Zend/XmlRpc/Value/Exception.php';
             $this->xmlrpc = new Zend_XmlRpc_Server();
             $this->xmlrpc->sendArgumentsToAllMethods(false);
             Yii::import('application.libraries.LSZend_XmlRpc_Response_Http');
             $this->xmlrpc->setResponseClass('LSZend_XmlRpc_Response_Http');
             $this->xmlrpc->setClass($oHandler);
             $result = $this->xmlrpc->handle();
             if ($result instanceof LSZend_XmlRpc_Response_Http) {
                 $result->printXml();
             } else {
                 // a Zend_XmlRpc_Server_Fault with exception message from XMLRPC
                 echo $result;
             }
         } elseif ($RPCType == 'json') {
             Yii::app()->loadLibrary('LSjsonRPCServer');
             if (!isset($_SERVER['CONTENT_TYPE'])) {
                 $serverContentType = explode(';', $_SERVER['HTTP_CONTENT_TYPE']);
                 $_SERVER['CONTENT_TYPE'] = reset($serverContentType);
             }
             LSjsonRPCServer::handle($oHandler);
         }
         foreach (App()->log->routes as $route) {
             $route->enabled = $route->enabled && !$route instanceof CWebLogRoute;
         }
         exit;
     } else {
         // Disabled output of API methods for now
         if (Yii::app()->getConfig("rpc_publish_api") == true && in_array($RPCType, array('xml', 'json'))) {
             $reflector = new ReflectionObject($oHandler);
             foreach ($reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                 /* @var $method ReflectionMethod */
                 if (substr($method->getName(), 0, 1) !== '_') {
                     $list[$method->getName()] = array('description' => str_replace(array("\r", "\r\n", "\n"), "<br/>", $method->getDocComment()), 'parameters' => $method->getParameters());
                 }
             }
             ksort($list);
             $aData['method'] = $RPCType;
             $aData['list'] = $list;
             $aData['display']['menu_bars'] = false;
             // Hide normal menu bar
             $this->_renderWrappedTemplate('remotecontrol', array('index_view'), $aData);
         }
     }
 }
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:62,代码来源:remotecontrol.php

示例2: indexAction

 public function indexAction()
 {
     $this->_helper->viewRenderer->setNoRender();
     $server = new Zend_XmlRpc_Server();
     $server->setClass('Application_Model_Data', 'cf');
     echo $server->handle();
 }
开发者ID:52M,项目名称:sample-json-rpc-php-android,代码行数:7,代码来源:ServerController.php

示例3: run

 /**
  * Run webservice
  *
  * @param Mage_Api_Controller_Action $controller
  * @return Mage_Api_Model_Server_Adapter_Xmlrpc
  */
 public function run()
 {
     $this->_xmlRpc = new Zend_XmlRpc_Server();
     $this->_xmlRpc->setClass($this->getHandler());
     $this->getController()->getResponse()->setHeader('Content-Type', 'text/xml')->setBody($this->_xmlRpc->handle());
     return $this;
 }
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:13,代码来源:Xmlrpc.php

示例4: testRequestResponseEncoding2

 /**
  * Test request/response encoding (alternate encoding)
  */
 public function testRequestResponseEncoding2()
 {
     $this->_server->setEncoding('ISO-8859-1');
     $response = $this->_server->handle();
     $request = $this->_server->getRequest();
     $this->assertEquals('ISO-8859-1', $request->getEncoding());
     $this->assertEquals('ISO-8859-1', $response->getEncoding());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:11,代码来源:ServerTest.php

示例5: run

 /**
  * Run webservice
  *
  * @return Mage_Api_Model_Server_Adapter_Xmlrpc
  */
 public function run()
 {
     $apiConfigCharset = Mage::getStoreConfig("api/config/charset");
     $this->_xmlRpc = new Zend_XmlRpc_Server();
     $this->_xmlRpc->setEncoding($apiConfigCharset)->setClass($this->getHandler());
     $this->getController()->getResponse()->clearHeaders()->setHeader('Content-Type', 'text/xml; charset=' . $apiConfigCharset)->setBody($this->_xmlRpc->handle());
     return $this;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:13,代码来源:Xmlrpc.php

示例6: xmlrpcServerAction

 public function xmlrpcServerAction()
 {
     Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
     $server = new Zend_XmlRpc_Server();
     $server->setClass('MyProject_BL_Member', 'member');
     header('Content-Type: text/xml');
     echo $server->handle();
     exit(0);
 }
开发者ID:rlecellier,项目名称:basezf,代码行数:9,代码来源:ServiceController.php

示例7: 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->assertEquals('key: value1', $response->getReturnValue());
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:9,代码来源:ServerTest.php

示例8: testCanMarshalBase64Requests

 /**
  * @group ZF-2872
  */
 public function testCanMarshalBase64Requests()
 {
     $this->_server->setClass('Zend_XmlRpc_Server_testClass', 'test');
     $data = base64_encode('this is the payload');
     $param = array('type' => 'base64', 'value' => $data);
     $request = new Zend_XmlRpc_Request('test.base64', array($param));
     $response = $this->_server->handle($request);
     $this->assertFalse($response instanceof Zend_XmlRpc_Fault);
     $this->assertEquals($data, $response->getReturnValue());
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:13,代码来源:ServerTest.php

示例9: run

 /**
  * This is the XML-RPC server routine
  *
  * @access public
  * @return void
  */
 public function run()
 {
     $RPCType = Yii::app()->getConfig("RPCInterface");
     if ($RPCType == 'xml') {
         $cur_path = get_include_path();
         set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers');
         // Yii::import was causing problems for some odd reason
         require_once 'Zend/XmlRpc/Server.php';
         require_once 'Zend/XmlRpc/Server/Exception.php';
         require_once 'Zend/XmlRpc/Value/Exception.php';
         $this->xmlrpc = new Zend_XmlRpc_Server();
         $this->xmlrpc->sendArgumentsToAllMethods(false);
         $this->xmlrpc->setClass('remotecontrol_handle', '', $this->controller);
         echo $this->xmlrpc->handle();
     } elseif ($RPCType == 'json') {
         Yii::app()->loadLibrary('jsonRPCServer');
         $oHandler = new remotecontrol_handle($this->controller);
         jsonRPCServer::handle($oHandler);
     }
     exit;
 }
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:27,代码来源:remotecontrol.php

示例10: run

 /**
  * This is the XML-RPC server routine
  *
  * @access public
  * @return void
  */
 public function run()
 {
     $oHandler = new remotecontrol_handle($this->controller);
     $RPCType = Yii::app()->getConfig("RPCInterface");
     if (Yii::app()->getRequest()->isPostRequest) {
         if ($RPCType == 'xml') {
             $cur_path = get_include_path();
             set_include_path($cur_path . PATH_SEPARATOR . APPPATH . 'helpers');
             // Yii::import was causing problems for some odd reason
             require_once 'Zend/XmlRpc/Server.php';
             require_once 'Zend/XmlRpc/Server/Exception.php';
             require_once 'Zend/XmlRpc/Value/Exception.php';
             $this->xmlrpc = new Zend_XmlRpc_Server();
             $this->xmlrpc->sendArgumentsToAllMethods(false);
             $this->xmlrpc->setClass($oHandler);
             echo $this->xmlrpc->handle();
         } elseif ($RPCType == 'json') {
             Yii::app()->loadLibrary('jsonRPCServer');
             jsonRPCServer::handle($oHandler);
         }
         exit;
     } else {
         // Disabled output of API methods for now
         if (1 == 2 && in_array($RPCType, array('xml', 'json'))) {
             $reflector = new ReflectionObject($oHandler);
             foreach ($reflector->getMethods(ReflectionMethod::IS_PUBLIC) as $method) {
                 /* @var $method ReflectionMethod */
                 if (substr($method->getName(), 0, 1) !== '_') {
                     $list[$method->getName()] = array('description' => str_replace(array("\r", "\r\n", "\n"), "<br/>", $method->getDocComment()), 'parameters' => $method->getParameters());
                 }
             }
             ksort($list);
             $aData['method'] = $RPCType;
             $aData['list'] = $list;
             $aData['display']['menu_bars'] = false;
             // Hide normal menu bar
             $this->_renderWrappedTemplate('remotecontrol', array('index_view'), $aData);
         }
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:46,代码来源:remotecontrol.php

示例11: testMulticall

 /**
  * multicall() test
  *
  * Call as method call 
  *
  * Expects:
  * - methods: 
  * 
  * Returns: array 
  */
 public function testMulticall()
 {
     $struct = array(array('methodName' => 'system.listMethods', 'params' => array()), array('methodName' => 'system.methodHelp', 'params' => array('system.multicall')));
     $request = new Zend_XmlRpc_Request();
     $request->setMethod('system.multicall');
     $request->addParam($struct);
     $response = $this->_server->handle($request);
     $this->assertTrue($response instanceof Zend_XmlRpc_Response, $response->__toString());
     $returns = $response->getReturnValue();
     $this->assertTrue(is_array($returns));
     $this->assertEquals(2, count($returns));
     $this->assertTrue(is_array($returns[0]), var_export($returns[0], 1));
     $this->assertTrue(is_string($returns[1]), var_export($returns[1], 1));
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:24,代码来源:ServerTest.php

示例12: pingAction

 /**
  * Ping should be called when new content is created
  */
 public function pingAction()
 {
     //Do not render anything, otherwise there will be an xml parse error
     $this->getHelper('viewRenderer')->setNoRender();
     $this->_helper->layout->disableLayout();
     try {
         //set up a new factory Zend xmlrpc server and add classes
         $server = new Zend_XmlRpc_Server();
         $server->setClass('Ifphp_Ping_XmlRpc', 'pingback');
         //success
         echo $server->handle();
     } catch (Exception $e) {
         throw $e;
     }
 }
开发者ID:akeemphilbert,项目名称:ifphp,代码行数:18,代码来源:XmlRpcController.php

示例13: 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:nhp,项目名称:shopware-4,代码行数:65,代码来源:System.php

示例14: xmlrpcServerAction

 public function xmlrpcServerAction()
 {
     // disable layout and view
     $this->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender();
     // set output format
     header('Content-Type: text/xml');
     // handle server request
     Zend_XmlRpc_Server_Fault::attachFaultException('Exception');
     $server = new Zend_XmlRpc_Server();
     $server->setClass('MyProject_Service_XmlRpc_Example', 'example');
     $response = $server->handle();
     // display response
     echo $response;
     exit(0);
 }
开发者ID:erider,项目名称:basezf,代码行数:16,代码来源:ServiceController.php

示例15: run

 public function run()
 {
     $enable = $this->get_enable();
     if (empty($enable)) {
         die;
     }
     include "Zend/Loader.php";
     Zend_Loader::registerAutoload();
     Zend_XmlRpc_Server_Fault::attachFaultException('moodle_exception');
     // retrieve the token from the url
     // if the token doesn't exist, set a class containing only get_token()
     $token = optional_param('token', null, PARAM_ALPHANUM);
     if (empty($token)) {
         $server = new Zend_XmlRpc_Server();
         $server->setClass("ws_authentication", "authentication");
         echo $server->handle();
     } else {
         // if token exist, do the authentication here
         /// TODO: following function will need to be modified
         $user = webservice_lib::mock_check_token($token);
         if (empty($user)) {
             throw new moodle_exception('wrongidentification');
         } else {
             /// TODO: probably change this
             global $USER;
             $USER = $user;
         }
         //retrieve the api name
         $classpath = optional_param(classpath, null, PARAM_ALPHA);
         require_once dirname(__FILE__) . '/../../' . $classpath . '/external.php';
         /// run the server
         $server = new Zend_XmlRpc_Server();
         $server->setClass($classpath . "_external", $classpath);
         echo $server->handle();
     }
 }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:36,代码来源:lib.php


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