X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=demo%2Fclient%2Fwrap.php;h=0b3022d950824dee820cad626fd2daefbbaa3166;hb=891efe4262d3cc5a379e0454f1f92c9dbdade9f7;hp=4dde5ba023fb189dff541327e8d6a12427aa1bc6;hpb=92e61c97411b8652b235e9c05d64934d83c53671;p=plcapi.git
diff --git a/demo/client/wrap.php b/demo/client/wrap.php
index 4dde5ba0..0b3022d9 100644
--- a/demo/client/wrap.php
+++ b/demo/client/wrap.php
@@ -21,31 +21,31 @@ $resp = $client->send(new PhpXmlRpc\Request('system.listMethods'));
if ($resp->faultCode()) {
echo "
Server methods list could not be retrieved: error {$resp->faultCode()} '" . htmlspecialchars($resp->faultString()) . "'
\n";
} else {
- $testCase = '';
- $wrapper = new PhpXmlRpc\Wrapper();
echo "Server methods list retrieved, now wrapping it up...
\n\n";
+ flush();
+
+ $callable = false;
+ $wrapper = new PhpXmlRpc\Wrapper();
foreach ($resp->value() as $methodName) {
// $resp->value is an array of strings
-
- // do not wrap remote server system methods
- if (strpos($methodName, 'system.') !== 0) {
- $funcName = $wrapper->wrap_xmlrpc_method($client, $methodName);
- if ($funcName) {
- echo "- Remote server method " . htmlspecialchars($methodName) . " wrapped into php function " . $funcName . "
\n";
+ if ($methodName == 'examples.getStateName') {
+ $callable = $wrapper->wrap_xmlrpc_method($client, $methodName);
+ if ($callable) {
+ echo "- Remote server method " . htmlspecialchars($methodName) . " wrapped into php function
\n";
} else {
echo "- Remote server method " . htmlspecialchars($methodName) . " could not be wrapped!
\n";
}
- if ($methodName == 'examples.getStateName') {
- $testCase = $funcName;
- }
+ break;
}
}
echo "
\n";
- if ($testCase) {
- echo "Now testing function $testCase: remote method to convert U.S. state number into state name";
+ flush();
+
+ if ($callable) {
+ echo "Now testing function for remote method to convert U.S. state number into state name";
$stateNum = rand(1, 51);
- $stateName = $testCase($stateNum, 2);
- echo "State number $stateNum is " . htmlspecialchars($stateName);
+ // the 2nd parameter gets added to the closure - it is teh debug level to be used for the client
+ $stateName = $callable($stateNum, 2);
}
}
?>