本文整理汇总了PHP中xmlrpc_server_register_method函数的典型用法代码示例。如果您正苦于以下问题:PHP xmlrpc_server_register_method函数的具体用法?PHP xmlrpc_server_register_method怎么用?PHP xmlrpc_server_register_method使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xmlrpc_server_register_method函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
$this->server = xmlrpc_server_create();
//http://www.hixie.ch/specs/pingback/pingback
//https://github.com/tedeh/pingback-php
xmlrpc_server_register_method($this->server, 'pingback.ping', [$this, 'pingback_ping']);
}
开发者ID:krausv,项目名称:www.zeminem.cz,代码行数:7,代码来源:Xmlrpc.php
示例2: __construct
/**
* XMLRPC server constructor
*
* @access private
*/
public function __construct($request, $params = array())
{
parent::__construct($request, $params);
$this->_server = xmlrpc_server_create();
foreach ($GLOBALS['registry']->listMethods() as $method) {
xmlrpc_server_register_method($this->_server, str_replace('/', '.', $method), array('Horde_Rpc_Xmlrpc', '_dispatcher'));
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:13,代码来源:Xmlrpc.php
示例3: handlePost
function handlePost()
{
$server = xmlrpc_server_create();
xmlrpc_server_register_method($server, 'pingback.ping', array($this, 'ping'));
echo xmlrpc_server_call_method($server, file_get_contents('php://input'), null, array('encoding' => 'utf-8'));
xmlrpc_server_destroy($server);
return true;
}
开发者ID:bashrc,项目名称:gnusocial-debian,代码行数:8,代码来源:pingback.php
示例4: __construct
public function __construct($options = array())
{
$this->_server = xmlrpc_server_create();
$this->setOptions($options);
if (!xmlrpc_server_register_method($this->_server, 'pingback.ping', array($this, '_ping'))) {
throw new PingbackException('Failed to register method to server');
}
}
开发者ID:jankal,项目名称:mvc,代码行数:8,代码来源:Server.php
示例5: init
/**
* Initialize the XMLRPC server
*
* @return void
*/
protected function init()
{
$this->XmlRpcServer = xmlrpc_server_create();
xmlrpc_server_register_method($this->XmlRpcServer, 'ns1.doSomething', array($this, '_xmlrpc_ns1_doSomething'));
xmlrpc_server_register_method($this->XmlRpcServer, 'ns2.getServerTime', array($this, '_xmlrpc_ns2_getServerTime'));
xmlrpc_server_register_method($this->XmlRpcServer, 'sayHello', array($this, '_xmlrpc_sayHello'));
// TODO how does this work?
//xmlrpc_server_register_introspection_callback($this->XmlRpcServer, array($this, '_xmlrpc_introspection'));
}
开发者ID:bostjanskufca,项目名称:PHP-application-server,代码行数:14,代码来源:A2o_AppSrv_Worker_DemoXmlRpc.php
示例6: registerMethod
/**
* @param string $methodName
* @param Callable $callback
* @return $this
*/
public function registerMethod($methodName, $callback)
{
xmlrpc_server_register_method($this->getHandle(), $methodName, function () use($callback) {
$input = func_get_args();
$output = call_user_func_array($callback, Xmlrpc::decodeValues($input));
return Xmlrpc::encodeValues($output);
});
return $this;
}
开发者ID:blar,项目名称:xmlrpc,代码行数:14,代码来源:XmlrpcServer.php
示例7: process
/**
* Processes an incoming request, executes it and builds a response.
*
* @since 5.1
* @param ModuleServerRequest $request Incoming request.
* @param ModuleServerResponse $response Outcoming response.
* @return void
*/
public function process(ModuleServerRequest $request, ModuleServerResponse $response)
{
$command = explode(' ', $request->getCommand());
$module_location = $command[1];
if (!strlen($module_location)) {
$response->sendWarning(ModuleServerResponse::SC_NOT_FOUND, 'Module location not defined.', ModuleServerRsponse::ERROR_CLASSNAME_MISSING);
return;
}
try {
$locator = new ModuleLocator('module://' . $request->getHeader('User') . ':' . $request->getHeader('Password') . '@/' . $module_location);
$sessionId = $request->getHeader('Session');
if ($sessionId) {
$this->module = ModuleFactory::getSessionModule($locator, $sessionId);
} else {
$this->module = ModuleFactory::getModule($locator);
}
} catch (ModuleException $e) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
return;
} catch (\Exception $e) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, $e->__toString());
return;
}
if (!($xmlrpc_server = xmlrpc_server_create())) {
$response->sendWarning(ModuleServerResponse::SC_INTERNAL_SERVER_ERROR, 'Internal error: Could not create an XML-RPC server.', ModuleServerResponse::ERROR_XMLRPC_ERROR);
return;
}
$theClass = new \ReflectionObject($this->module);
$methods = $theClass->getMethods();
foreach ($methods as $method) {
// Ignore private methods
$theMethod = new \ReflectionMethod($theClass->getName(), $method->getName());
if (!$theMethod->isPublic()) {
continue;
}
// Expose only methods beginning with "module" prefix
if (!(substr($method->getName(), 0, 6) == 'module')) {
continue;
}
xmlrpc_server_register_method($xmlrpc_server, strtolower($method->getName()), array($this, 'xmlrpcGateway'));
}
xmlrpc_server_register_introspection_callback($xmlrpc_server, array($this, 'introspectionGateway'));
try {
$buffer = xmlrpc_server_call_method($xmlrpc_server, $request->getPayload(), '', array('output_type' => 'xml'));
$response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_OK);
$response->setBuffer($buffer);
} catch (\Exception $e) {
$response->addHeader('Module/1.0 ' . ModuleServerResponse::SC_INTERNAL_ERROR);
$response->setBuffer($buffer);
}
xmlrpc_server_destroy($xmlrpc_server);
$context = new ModuleContext($module_location);
$session = new \Innomatic\Module\Session\ModuleSession($context, $sessionId);
$session->save($this->module);
$response->addHeader('Session: ' . $session->getId());
}
开发者ID:kchizi,项目名称:innomatic-legacy,代码行数:64,代码来源:ModuleServerXmlRpcProcessor.php
示例8: __construct
function __construct($payload, $payload_signed, $payload_encrypted)
{
$this->payload = $payload;
// xmlrpc_decode_request is defined such that the '$method' string is
// passed in by reference.
$this->params = xmlrpc_decode_request($this->payload, $this->method, 'UTF-8');
// The method name is not allowed to have a dot, except for a single dot
// which preceeds the php extension. It can have slashes but it cannot
// begin with a slash. We specifically don't want .. to be possible.
if (0 == preg_match("@^[A-Za-z0-9]+/[A-Za-z0-9/_-]+(\\.php/)?[A-Za-z0-9_-]+\$@", $this->method)) {
throw new XmlrpcServerException('The function does not exist', 6010);
}
if ($payload_signed && $payload_encrypted || $this->method == 'system/keyswap') {
// The remote server's credentials checked out.
// You might want to enable some methods for unsigned/unencrypted
// transport
} else {
// For now, we throw an exception
throw new XmlrpcServerException('The signature on your message was not valid', 6005);
}
// The system methods are treated differently.
if (array_key_exists($this->method, $this->system_methods)) {
$xmlrpcserver = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpcserver, $this->method, array(&$this, $this->system_methods[$this->method]));
} else {
// Security: I'm thinking that we should not return separate errors for
// the file not existing, the file not being readable, etc. as
// it might provide an opportunity for outsiders to scan the
// server for random files. So just a single message/code for
// all failures here kthxbye.
if (strpos($this->method, '/') !== false) {
$this->callstack = explode('/', $this->method);
} else {
throw new XmlrpcServerException('The function does not exist', 6011);
}
// Read custom xmlrpc functions from local
if (function_exists('local_xmlrpc_services')) {
foreach (local_xmlrpc_services() as $name => $localservices) {
$this->services[$name] = array_merge($this->services[$name], $localservices);
}
}
foreach ($this->services as $container) {
if (array_key_exists($this->method, $container)) {
$xmlrpcserver = xmlrpc_server_create();
$bool = xmlrpc_server_register_method($xmlrpcserver, $this->method, 'api_dummy_method');
$this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $container[$this->method], array("encoding" => "utf-8"));
$bool = xmlrpc_server_destroy($xmlrpcserver);
return $this->response;
}
}
throw new XmlrpcServerException('No such method: ' . $this->method);
}
$temp = '';
$this->response = xmlrpc_server_call_method($xmlrpcserver, $payload, $temp, array("encoding" => "utf-8"));
return $this->response;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:56,代码来源:dispatcher.php
示例9: __construct
/**
* Create a new XML-RPC Server.
*
* The constructor receives a mandatory parameter: the Call Handler. The call handler executes the actual
* method call. XML_RPC2 server acts as a protocol decoder/encoder between the call handler and the client
*
* @param object $callHandler
* @param array $options associative array of options
*/
function __construct($callHandler, $options = array())
{
parent::__construct($callHandler, $options);
$this->_xmlrpcextServer = xmlrpc_server_create();
foreach ($callHandler->getMethods() as $method) {
if (xmlrpc_server_register_method($this->_xmlrpcextServer, $method->getName(), array($this, 'epiFunctionHandlerAdapter')) !== true) {
throw new XML_RPC2_Exception('Unable to setup XMLRPCext server. xmlrpc_server_register_method returned non-true.');
}
}
}
开发者ID:Esleelkartea,项目名称:kz-adeada-talleres-electricos-,代码行数:19,代码来源:Server.php
示例10: add_to_map
function add_to_map($methodname, $function, $sig, $doc)
{
xmlrpc_server_register_method($this->server, $methodname, $function);
// xmlrpc_server_register_method($this->server,$methodname,'xmlrpc_call_wrapper');
// $descr = array(
// 'function' => $function,
// 'signature' => $sig,
// 'docstring' => $doc
// );
// xmlrpc_server_set_method_description($this->server,$methodname,$descr);
$this->dmap[$methodname] = array('function' => $function, 'signature' => $sig, 'docstring' => $doc);
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:12,代码来源:class.xmlrpc_server_epi.inc.php
示例11: __construct
/**
* XMLRPC server constructor.
*/
function __construct($request, $params = array())
{
parent::__construct($request, $params);
$this->_server = xmlrpc_server_create();
// Register only phpgw services.
foreach ($GLOBALS['registry']->listMethods('phpgw') as $method) {
$methods = explode('/', $method);
array_shift($methods);
$method = implode('.', $methods);
xmlrpc_server_register_method($this->_server, $method, array('Horde_Rpc_Phpgw', '_dispatcher'));
}
}
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Phpgw.php
示例12: _registerMethod
/**
* register a method
* @param string $pMethod
* @param string $pCallback
*/
public function _registerMethod($pMethod, $pCallback = null)
{
if (!isset($pCallback)) {
$pCallback = array(&$this, $pMethod);
}
if (!\is_callable($pCallback)) {
throw new EXMLRPCServer("method %s is not callable", $pMethod);
}
if (!\xmlrpc_server_register_method($this->server, $pMethod, $pCallback)) {
throw new EXMLRPCServer("method %s could not be registered", $pMethod);
}
}
开发者ID:Broncko,项目名称:Savant,代码行数:17,代码来源:AXMLRPCServer.php
示例13: serializationAction
/**
* This won't ever be called unless there is an error
*/
function serializationAction(&$body)
{
$request_xml = $body->getValue();
$toSerialize = $body->getResults();
$lambdaFunc = 'return $userData;';
$func = create_function('$a,$b,$userData', $lambdaFunc);
$xmlrpc_server = xmlrpc_server_create();
$request_xml = $body->getValue();
xmlrpc_server_register_method($xmlrpc_server, $body->packageClassMethodName, $func);
$response = xmlrpc_server_call_method($xmlrpc_server, $request_xml, $toSerialize);
$body->setResults($response);
}
开发者ID:FalconGT,项目名称:DrEvony,代码行数:15,代码来源:Actions.php
示例14: processRequest
/**
* Request processor
* @param object $handler
* @param array|bool $methodsList If omitted, handler should contain getMethods() method
* @return string
*/
public function processRequest($handler, $methodsList = false)
{
$server = xmlrpc_server_create();
if (!$methodsList) {
$methodsList = $handler->getMethods();
}
foreach ($methodsList as $method) {
xmlrpc_server_register_method($server, $method, [$handler, $method]);
}
$request = (isset($HTTP_RAW_POST_DATA) and $HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
$response = xmlrpc_server_call_method($server, $request, null);
xmlrpc_server_destroy($server);
return $response;
}
开发者ID:difra-org,项目名称:difra,代码行数:20,代码来源:XMLRPC.php
示例15: processRequest
function processRequest(&$request_xml)
{
// define XML-RPC server
$server = xmlrpc_server_create();
// log for debuggin
$fp = fopen("/var/tmp/ws_request.log", "a");
fwrite($fp, date("H:i") . "\n");
fwrite($fp, $request_xml);
fwrite($fp, "\n\n");
fclose($fp);
// register methods
xmlrpc_server_register_method($server, "getQueueValues", "rpc_get_queue_values");
xmlrpc_server_register_method($server, "pushValue", "rpc_push_value");
xmlrpc_server_register_method($server, "getStateData", "rpc_get_state_data");
xmlrpc_server_register_method($server, "setStateData", "rpc_set_state_data");
xmlrpc_server_register_method($server, "helloWorld", "rpc_hello_world");
xmlrpc_server_register_method($server, "noop", "rpc_hello_world");
// call the method
$response =& xmlrpc_server_call_method($server, $request_xml, '');
// send back the respond
print $response;
// release resources
xmlrpc_server_destroy($server);
}
开发者ID:andrewhuang,项目名称:webscheme,代码行数:24,代码来源:xmlrpc.php
示例16: registerRpcMethods
/**
* registers xml rpc functions
* @see RpcProvider::registerRpcMethods
*/
public function registerRpcMethods(RpcServer $rpcServer)
{
//xmlrpc_server_register_method($rpcServer->server,__CLASS__.".getTypeList", array(&$this,'getTypeList'));
xmlrpc_server_register_method($rpcServer->server, __CLASS__ . ".getTagList", array(&$this, 'handleRpcRequest'));
}
开发者ID:rverbrugge,项目名称:dif,代码行数:9,代码来源:ThemeHandler.php
示例17: array
}
if ($row['category'] == 28) {
$category = "Charity/Support Groups";
}
if ($row['category'] == 29) {
$category = "Miscellaneous";
}
$data[] = array("event_id" => $row["eventid"], "creator" => $row["creatoruuid"], "name" => $row["name"], "category" => $category, "description" => $row["description"], "date" => $date, "dateUTC" => $row["dateUTC"], "duration" => $row["duration"], "covercharge" => $row["covercharge"], "coveramount" => $row["coveramount"], "simname" => $row["simname"], "globalposition" => $row["globalPos"], "eventflags" => $row["eventflags"]);
}
$response_xml = xmlrpc_encode(array('success' => True, 'errorMessage' => "", 'data' => $data));
print $response_xml;
}
#
# Classifieds Info Query
#
xmlrpc_server_register_method($xmlrpc_server, "classifieds_info_query", "classifieds_info_query");
function classifieds_info_query($method_name, $params, $app_data)
{
$req = $params[0];
$classifiedID = $req['classifiedID'];
$sql = "SELECT * FROM classifieds WHERE classifieduuid = '" . mysql_real_escape_string($classifiedID) . "'";
$result = mysql_query($sql);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
$data[] = array("classifieduuid" => $row["classifieduuid"], "creatoruuid" => $row["creatoruuid"], "creationdate" => $row["creationdate"], "expirationdate" => $row["expirationdate"], "category" => $row["category"], "name" => $row["name"], "description" => $row["description"], "parceluuid" => $row["parceluuid"], "parentestate" => $row["parentestate"], "snapshotuuid" => $row["snapshotuuid"], "simname" => $row["simname"], "posglobal" => $row["posglobal"], "parcelname" => $row["parcelname"], "classifiedflags" => $row["classifiedflags"], "priceforlisting" => $row["priceforlisting"]);
}
$response_xml = xmlrpc_encode(array('success' => True, 'errorMessage' => "", 'data' => $data));
print $response_xml;
}
#
# Process the request
开发者ID:OS-Development,项目名称:OpenSim.Search,代码行数:31,代码来源:query.php
示例18: _register
/**
* Exporte la fonction/méthode $privateName ou, si non renseigné,
* $publicname comme méthode publique rpc.
*
* @access protected
* @return void
*/
private function _register($publicName, $privateName, $isMethod = false)
{
if (false == $privateName) {
if (($dot = strrpos($publicName, '.')) > 0) {
$privateName = substr($publicName, $dot + 1);
} else {
$privateName = $publicName;
}
}
if ($isMethod) {
$key = 'method';
$func = array($this, $privateName);
$exists = method_exists($this, $privateName);
} else {
$key = 'function';
$func = $privateName;
$exists = function_exists($privateName);
}
if ($exists) {
$this->methodMap[$publicName] = array($key => $privateName);
xmlrpc_server_register_method($this->_server, $publicName, $func);
}
}
开发者ID:arhe,项目名称:pwak,代码行数:30,代码来源:Server.php
示例19: addIntrospectionData
/**
* Generate method and type information to add introspection data.
* The information required is generated from annotations.
* All methods are registered with the server, and introspection data
* is added to the server.
*
* @param resource $xmlrpc_server XML RPC server
* @param array $service_description Description
* @param array &$method_aliases Aliases
* @param object $xmlrpc_das Unknown
*
* @return string Method description
*/
public function addIntrospectionData($xmlrpc_server, $service_description, &$method_aliases, $xmlrpc_das = null)
{
if ($xmlrpc_das == null) {
$xsds = SCA_Helper::getAllXsds($service_description->class_name);
$xmlrpc_das = new SCA_Bindings_Xmlrpc_DAS();
foreach ($xsds as $index => $xsds) {
list($namespace, $xsdfile) = $xsds;
if (SCA_Helper::isARelativePath($xsdfile)) {
$xsd = SCA_Helper::constructAbsolutePath($xsdfile, $service_description->class_name);
$xmlrpc_das->addTypesXsdFile($xsd);
}
}
}
$type_list = array();
$methodDesc = <<<END
<?xml version='1.0'?>
<introspection version='1.0'>
<methodList>
END;
foreach ($service_description->operations as $methodName => $methodInfo) {
$methodParams = "";
$methodReturn = "";
if (array_key_exists("name", $methodInfo) && array_key_exists("name", $methodInfo["name"]) && $methodInfo["name"]["name"] != null && strlen($methodInfo["name"]["name"]) > 0) {
$xmlrpcMethodName = $methodInfo["name"]["name"];
$method_aliases[$xmlrpcMethodName] = $methodName;
} else {
$xmlrpcMethodName = $methodName;
}
xmlrpc_server_register_method($xmlrpc_server, $xmlrpcMethodName, $methodName);
if (array_key_exists("parameters", $methodInfo) && $methodInfo["parameters"] != null) {
foreach ($methodInfo["parameters"] as $param) {
$paramName = $param["name"];
if (array_key_exists('objectType', $param)) {
$paramType = $param["objectType"];
$this->generateType($param["namespace"], $param["objectType"], $type_list, $xmlrpc_das);
} else {
$paramType = $this->sdoTypeToXmlRpcType($param["type"]);
}
$methodParams = $methodParams . <<<END
<value type='{$paramType}' desc='{$paramName}'>
</value>
END;
}
}
if (array_key_exists("return", $methodInfo) && $methodInfo["return"] != null) {
foreach ($methodInfo["return"] as $ret) {
if (array_key_exists('objectType', $ret)) {
$retType = $ret["objectType"];
$this->generateType($ret["namespace"], $ret["objectType"], $type_list, $xmlrpc_das);
} else {
$retType = $this->sdoTypeToXmlRpcType($ret["type"]);
}
$methodReturn = $methodReturn . <<<END
<value type='{$retType}' desc='return'>
</value>
END;
}
}
$methodDesc = $methodDesc . <<<END
<methodDescription name='{$xmlrpcMethodName}'>
<author></author>
<purpose></purpose>
<version></version>
<signatures>
<signature>
<params>
{$methodParams}
</params>
<returns>
{$methodReturn}
</returns>
</signature>
</signatures>
</methodDescription>
END;
}
$methodDesc = $methodDesc . "</methodList>\n";
if (count($type_list) > 0) {
$methodDesc = $methodDesc . "<typeList>\n";
foreach ($type_list as $type) {
//.........这里部分代码省略.........
开发者ID:psagi,项目名称:sdo,代码行数:101,代码来源:ServiceDescriptionGenerator.php
示例20: mnet_server_invoke_dangerous_method
/**
* Initialize the object (if necessary), execute the method or function, and
* return the response
*
* @param string $includefile The file that contains the object definition
* @param string $methodname The name of the method to execute
* @param string $method The full path to the method
* @param string $payload The XML-RPC request payload
* @param string $class The name of the class to instantiate (or false)
*
* @throws mnet_server_exception
*
* @return string The XML-RPC response
*/
function mnet_server_invoke_dangerous_method($includefile, $methodname, $method, $payload) {
if (file_exists($CFG->dirroot . $includefile)) {
require_once $CFG->dirroot . $includefile;
// $callprefix matches the rpc convention
// of not having a leading slash
$callprefix = preg_replace('!^/!', '', $includefile);
} else {
throw new mnet_server_exception(705, "nosuchfile");
}
if ($functionname != clean_param($functionname, PARAM_PATH)) {
throw new mnet_server_exception(7012, "nosuchfunction");
}
if (!function_exists($functionname)) {
throw new mnet_server_exception(7012, "nosuchfunction");
}
$xmlrpcserver = xmlrpc_server_create();
xmlrpc_server_register_method($xmlrpcserver, $method, 'mnet_server_dummy_method');
$response = xmlrpc_server_call_method($xmlrpcserver, $payload, $methodname, array("encoding" => "utf-8"));
xmlrpc_server_destroy($xmlrpcserver);
return $response;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:38,代码来源:serverlib.php
注:本文中的xmlrpc_server_register_method函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论