當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_XmlRpc_Server類代碼示例

本文整理匯總了PHP中Zend_XmlRpc_Server的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_XmlRpc_Server類的具體用法?PHP Zend_XmlRpc_Server怎麽用?PHP Zend_XmlRpc_Server使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_XmlRpc_Server類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: testGetSave

 /**
  * Tests functionality of both get() and save()
  */
 public function testGetSave()
 {
     if (!is_writeable('./')) {
         throw new PHPUnit_Framework_IncompleteTestError('Directory not writeable');
     }
     $this->assertTrue(Zend_XmlRpc_Server_Cache::save($this->_file, $this->_server));
     $expected = $this->_server->listMethods();
     $server = new Zend_XmlRpc_Server();
     $this->assertTrue(Zend_XmlRpc_Server_Cache::get($this->_file, $server));
     $actual = $server->listMethods();
     $this->assertSame($expected, $actual);
 }
開發者ID:jorgenils,項目名稱:zend-framework,代碼行數:15,代碼來源:CacheTest.php

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: get

 /**
  * Add dispatch table from a file
  *
  * Unserializes a stored dispatch table. Returns false if it
  * fails in any way, true on success.
  *
  * Useful to prevent needing to build the dispatch list on each XMLRPC
  * request. Sample usage:
  *
  * <code>
  * if (!Zym_XmlRpc_Server_Cache::get($id, $coreCache, $server)) {
  *     require_once 'Some/Service/Class.php';
  *     require_once 'Another/Service/Class.php';
  *
  *     // Attach Some_Service_Class with namespace 'some'
  *     $server->setClass('Some_Service_Class', 'some');
  *
  *     // Attach Another_Service_Class with namespace 'another'
  *     $server->setClass('Another_Service_Class', 'another');
  *
  *     Zym_XmlRpc_Server_Cache::save($id, $coreCache, $server);
  * }
  *
  * $response = $server->handle();
  * echo $response;
  * </code>
  *
  * @param string             $id
  * @param Zend_Cache_Core    $coreCache
  * @param Zend_XmlRpc_Server $server
  *
  * @return boolean
  */
 public static function get($id, Zend_Cache_Core $coreCache, Zend_XmlRpc_Server $server)
 {
     $dispatchArray = @unserialize($coreCache->load($id, false, true));
     try {
         $server->loadFunctions($dispatchArray);
     } catch (Zend_XmlRpc_Server_Exception $e) {
         return false;
     }
     return true;
 }
開發者ID:BGCX262,項目名稱:zym-svn-to-git,代碼行數:43,代碼來源:Cache.php

示例10: testCanMarshalBase64Requests

 /**
  * @see 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:jon9872,項目名稱:zend-framework,代碼行數:13,代碼來源:ServerTest.php

示例11: fault

 /**
  * Raise an xmlrpc server fault
  *
  * Moodle note: the difference with the Zend server is that we throw a plain PHP Exception
  * with the debuginfo integrated to the exception message when DEBUG >= NORMAL
  *
  * @param string|Exception $fault
  * @param int $code
  * @return Zend_XmlRpc_Server_Fault
  */
 public function fault($fault = null, $code = 404)
 {
     //intercept any exceptions with debug info and transform it in Moodle exception
     if ($fault instanceof Exception) {
         //add the debuginfo to the exception message if debuginfo must be returned
         if (debugging() and isset($fault->debuginfo)) {
             $fault = new Exception($fault->getMessage() . ' | DEBUG INFO: ' . $fault->debuginfo, 0);
         }
     }
     return parent::fault($fault, $code);
 }
開發者ID:LMSeXT,項目名稱:SAWEE-WS_server-engine,代碼行數:21,代碼來源:locallib.php

示例12: 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

示例13: testGetSave

 /**
  * Tests functionality of both get() and save()
  *
  * @return void
  */
 public function testGetSave()
 {
     if (!is_writeable(dirname(__FILE__))) {
         $this->markTestIncomplete('Directory no writable');
     }
     $this->assertTrue(Zym_XmlRpc_Server_Cache::save('cache', $this->_cache, $this->_server));
     $expected = $this->_server->listMethods();
     $server = new Zend_XmlRpc_Server();
     $this->assertTrue(Zym_XmlRpc_Server_Cache::get('cache', $this->_cache, $server));
     $actual = $server->listMethods();
     $this->assertSame($expected, $actual);
 }
開發者ID:BGCX262,項目名稱:zym-svn-to-git,代碼行數:17,代碼來源:CacheTest.php

示例14: 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

示例15: pingAction

 /**
  * receive a ping
  */
 public function pingAction()
 {
     $owApp = OntoWiki::getInstance();
     $logger = $owApp->logger;
     $logger->debug('Pingback Server Init.');
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
     $this->_owApp->appendMessage(new OntoWiki_Message('Ping received.', OntoWiki_Message::INFO));
     $post = $this->_request->getPost();
     if (isset($post['source']) && isset($post['target'])) {
         // Simplified Semantic Pingback
         // read config and put it into options
         $options = array();
         $config = $this->_privateConfig;
         if (isset($config->rdfa->enabled)) {
             $options['rdfa'] = $config->rdfa->enabled;
         }
         if (isset($config->titleProperties)) {
             $options['title_properties'] = $config->titleProperties->toArray();
         }
         if (isset($config->genericRelation)) {
             $options['generic_relation'] = $config->genericRelation;
         }
         $ping = new Erfurt_Ping($options);
         echo $ping->receive($post['source'], $post['target']);
         return;
     } else {
         // Create XML RPC Server
         $server = new Zend_XmlRpc_Server();
         $server->setClass($this, 'pingback');
         // Let the server handle the RPC calls.
         $response = $this->getResponse();
         $response->setBody($server->handle());
         return;
     }
 }
開發者ID:dmj,項目名稱:uni-helmstedt.hab.de,代碼行數:39,代碼來源:PingbackController.php


注:本文中的Zend_XmlRpc_Server類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。