本文整理汇总了PHP中SOAP_Server::setCallHandler方法的典型用法代码示例。如果您正苦于以下问题:PHP SOAP_Server::setCallHandler方法的具体用法?PHP SOAP_Server::setCallHandler怎么用?PHP SOAP_Server::setCallHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SOAP_Server
的用法示例。
在下文中一共展示了SOAP_Server::setCallHandler方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: myCallHandler
/* tell server to translate to classes we provide if possible */
$server->_auto_translation = true;
/* This is a simple example of implementing a custom
call handler. If you do this, the soap server will ignore
objects or functions added to it, and will call your handler
for **ALL** soap calls the server receives, wether the call
is defined in your WSDL or not. The handler receives two
arguments, the method name being called, and the arguments
sent for that call.
*/
function myCallHandler($methodname, $args)
{
global $soapclass;
return @call_user_func_array(array($soapclass, $methodname), $args);
}
$server->setCallHandler('myCallHandler', false);
require_once 'example_server.php';
$soapclass = new SOAP_Example_Server();
$server->addObjectMap($soapclass, 'urn:SOAP_Example_Server');
if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') {
$server->service($HTTP_RAW_POST_DATA);
} else {
require_once 'SOAP/Disco.php';
$disco = new SOAP_DISCO_Server($server, 'ServerExample');
header("Content-type: text/xml");
if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'], 'wsdl') == 0) {
echo $disco->getWSDL();
} else {
echo $disco->getDISCO();
}
exit;