示例#1
0
 *
 * @return string the name of the state (or error description)
 *
 * @throws Exception if state is not found
 */
function inner_findstate($stateNo)
{
    global $stateNames;
    if (isset($stateNames[$stateNo - 1])) {
        return $stateNames[$stateNo - 1];
    } else {
        // not, there so complain
        throw new Exception("I don't have a state for the index '" . $stateNo . "'", PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser);
    }
}
$wrapper = new PhpXmlRpc\Wrapper();
$findstate2_sig = $wrapper->wrapPhpFunction('inner_findstate');
$findstate3_sig = $wrapper->wrapPhpFunction(array('xmlrpcServerMethodsContainer', 'findState'));
$obj = new xmlrpcServerMethodsContainer();
$findstate4_sig = $wrapper->wrapPhpFunction(array($obj, 'findstate'));
$findstate5_sig = $wrapper->wrapPhpFunction('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true));
eval($findstate5_sig['source']);
$findstate6_sig = $wrapper->wrapPhpFunction('inner_findstate', '', array('return_source' => true));
eval($findstate6_sig['source']);
$findstate7_sig = $wrapper->wrapPhpFunction(array('xmlrpcServerMethodsContainer', 'findState'), '', array('return_source' => true));
eval($findstate7_sig['source']);
$obj = new xmlrpcServerMethodsContainer();
$findstate8_sig = $wrapper->wrapPhpFunction(array($obj, 'findstate'), '', array('return_source' => true));
eval($findstate8_sig['source']);
$findstate9_sig = $wrapper->wrapPhpFunction('xmlrpcServerMethodsContainer::findState', '', array('return_source' => true));
eval($findstate9_sig['source']);
示例#2
0
         $msig = $encoder->decode($r2);
         $msig = $msig[$methodsig];
         $proto = $protocol == 2 ? 'https' : $protocol == 1 ? 'http11' : '';
         if ($proxy == '' && $username == '' && !$requestcompression && !$responsecompression && $clientcookies == '') {
             $opts = 1;
             // simple client copy in stub code
         } else {
             $opts = 0;
             // complete client copy in stub code
         }
         if ($wstype == 1) {
             $prefix = 'jsonrpc';
         } else {
             $prefix = 'xmlrpc';
         }
         $wrapper = new PhpXmlRpc\Wrapper();
         $code = $wrapper->buildWrapMethodSource($client, $method, array('timeout' => $timeout, 'protocol' => $proto, 'simple_client_copy' => $opts, 'prefix' => $prefix), str_replace('.', '_', $prefix . '_' . $method), $msig, $mdesc);
         //if ($code)
         //{
         echo "<div id=\"phpcode\">\n";
         highlight_string("<?php\n" . $code['docstring'] . $code['source'] . '?>');
         echo "\n</div>";
         //}
         //else
         //{
         //  echo 'Error while building php code stub...';
     }
     break;
 case 'execute':
     echo '<div id="response"><h2>Response:</h2>' . htmlspecialchars($response->serialize()) . '</div>';
     break;
示例#3
0
    See also proxy.php for an alternative take
</h3>
<?php 
include_once __DIR__ . "/../../src/Autoloader.php";
PhpXmlRpc\Autoloader::register();
$client = new PhpXmlRpc\Client("http://phpxmlrpc.sourceforge.net/server.php");
$client->return_type = 'phpvals';
// let client give us back php values instead of xmlrpcvals
$resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
if ($resp->faultCode()) {
    echo "<p>Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'</p>\n";
} else {
    echo "<p>Server methods list retrieved, now wrapping it up...</p>\n<ul>\n";
    flush();
    $callable = false;
    $wrapper = new PhpXmlRpc\Wrapper();
    foreach ($resp->value() as $methodName) {
        // $resp->value is an array of strings
        if ($methodName == 'examples.getStateName') {
            $callable = $wrapper->wrapXmlrpcMethod($client, $methodName);
            if ($callable) {
                echo "<li>Remote server method " . htmlspecialchars($methodName) . " wrapped into php function</li>\n";
            } else {
                echo "<li>Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!</li>\n";
            }
            break;
        }
    }
    echo "</ul>\n";
    flush();
    if ($callable) {