3 * Demo server for xmlrpc library.
5 * Implements a lot of webservices, including a suite of services used for
6 * interoperability testing (validator1 methods), and some whose only purpose
7 * is to be used for unit-testing the library.
9 * Please do not copy this file verbatim into your production server.
12 // give user a chance to see the source for this server instead of running the services
13 if ($_SERVER['REQUEST_METHOD'] != 'POST' && isset($_GET['showSource'])) {
14 highlight_file(__FILE__);
18 include_once __DIR__ . "/../../vendor/autoload.php";
20 // out-of-band information: let the client manipulate the server operations.
21 // we do this to help the testsuite script: do not reproduce in production!
22 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
23 $GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage';
24 if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) {
25 mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']);
28 include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php";
34 * Used to test usage of object methods in dispatch maps and in wrapper code.
36 class xmlrpcServerMethodsContainer
39 * Method used to test logging of php warnings generated by user functions.
41 public function phpWarningGenerator($m)
43 $a = $undefinedVariable; // this triggers a warning in E_ALL mode, since $undefinedVariable is undefined
44 return new PhpXmlRpc\Response(new Value(1, 'boolean'));
48 * Method used to test catching of exceptions in the server.
50 public function exceptionGenerator($m)
52 throw new Exception("it's just a test", 1);
56 * A PHP version of the state-number server. Send me an integer and i'll sell you a state
60 public static function findState($s)
62 return inner_findstate($s);
66 // a PHP version of the state-number server
67 // send me an integer and i'll sell you a state
70 "Alabama", "Alaska", "Arizona", "Arkansas", "California",
71 "Colorado", "Columbia", "Connecticut", "Delaware", "Florida",
72 "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
73 "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
74 "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
75 "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina",
76 "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
77 "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont",
78 "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming",
81 $findstate_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcInt));
82 $findstate_doc = 'When passed an integer between 1 and 51 returns the
83 name of a US state, where the integer is the index of that state name
84 in an alphabetic order.';
86 function findState($m)
90 // get the first param
91 $sno = $m->getParam(0);
93 // param must be there and of the correct type: server object does the validation for us
95 // extract the value of the state number
96 $snv = $sno->scalarval();
97 // look it up in our array (zero-based)
98 if (isset($stateNames[$snv - 1])) {
99 $stateName = $stateNames[$snv - 1];
101 // not there, so complain
102 $err = "I don't have a state for the index '" . $snv . "'";
105 // if we generated an error, create an error return response
107 return new PhpXmlRpc\Response(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser, $err);
109 // otherwise, we create the right response with the state name
110 return new PhpXmlRpc\Response(new Value($stateName));
115 * Inner code of the state-number server.
116 * Used to test auto-registration of PHP functions as xmlrpc methods.
118 * @param integer $stateNo the state number
120 * @return string the name of the state (or error description)
122 function inner_findstate($stateNo)
125 if (isset($stateNames[$stateNo - 1])) {
126 return $stateNames[$stateNo - 1];
128 // not, there so complain
129 return "I don't have a state for the index '" . $stateNo . "'";
133 $wrapper = new PhpXmlRpc\Wrapper();
135 $findstate2_sig = $wrapper->wrap_php_function('inner_findstate');
137 $findstate3_sig = $wrapper->wrap_php_function(array('xmlrpcServerMethodsContainer', 'findState'));
139 $findstate5_sig = $wrapper->wrap_php_function('xmlrpcServerMethodsContainer::findState');
141 $obj = new xmlrpcServerMethodsContainer();
142 $findstate4_sig = $wrapper->wrap_php_function(array($obj, 'findstate'));
144 $addtwo_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt, Value::$xmlrpcInt));
145 $addtwo_doc = 'Add two integers together and return the result';
148 $s = $m->getParam(0);
149 $t = $m->getParam(1);
151 return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), "int"));
154 $addtwodouble_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble, Value::$xmlrpcDouble));
155 $addtwodouble_doc = 'Add two doubles together and return the result';
156 function addTwoDouble($m)
158 $s = $m->getParam(0);
159 $t = $m->getParam(1);
161 return new PhpXmlRpc\Response(new Value($s->scalarval() + $t->scalarval(), "double"));
164 $stringecho_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString));
165 $stringecho_doc = 'Accepts a string parameter, returns the string.';
166 function stringEcho($m)
168 // just sends back a string
169 $s = $m->getParam(0);
170 $v = $s->scalarval();
172 return new PhpXmlRpc\Response(new Value($s->scalarval()));
175 $echoback_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString));
176 $echoback_doc = 'Accepts a string parameter, returns the entire incoming payload';
177 function echoBack($m)
179 // just sends back a string with what i got sent to me, just escaped, that's all
180 $s = "I got the following message:\n" . $m->serialize();
182 return new PhpXmlRpc\Response(new Value($s));
185 $echosixtyfour_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcBase64));
186 $echosixtyfour_doc = 'Accepts a base64 parameter and returns it decoded as a string';
187 function echoSixtyFour($m)
189 // accepts an encoded value, but sends it back
190 // as a normal string. this is to test base64 encoding
191 // is working as expected
192 $incoming = $m->getParam(0);
194 return new PhpXmlRpc\Response(new Value($incoming->scalarval(), "string"));
197 $bitflipper_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
198 $bitflipper_doc = 'Accepts an array of booleans, and returns them inverted';
199 function bitFlipper($m)
201 $v = $m->getParam(0);
202 $sz = $v->arraysize();
203 $rv = new Value(array(), Value::$xmlrpcArray);
205 for ($j = 0; $j < $sz; $j++) {
206 $b = $v->arraymem($j);
207 if ($b->scalarval()) {
208 $rv->addScalar(false, "boolean");
210 $rv->addScalar(true, "boolean");
214 return new PhpXmlRpc\Response($rv);
219 // send me an array of structs thus:
226 // and I'll return it to you in sorted order
228 function agesorter_compare($a, $b)
230 global $agesorter_arr;
232 // don't even ask me _why_ these come padded with hyphens, I couldn't tell you :p
233 $a = str_replace("-", "", $a);
234 $b = str_replace("-", "", $b);
236 if ($agesorter_arr[$a] == $agesorter_arr[$b]) {
240 return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
243 $agesorter_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
244 $agesorter_doc = 'Send this method an array of [string, int] structs, eg:
251 And the array will be returned with the entries sorted by their numbers.
253 function ageSorter($m)
255 global $agesorter_arr, $s;
257 PhpXmlRpc\Server::xmlrpc_debugmsg("Entering 'agesorter'");
259 $sno = $m->getParam(0);
260 // error string for [if|when] things go wrong
262 // create the output value
266 $max = $sno->arraysize();
267 PhpXmlRpc\Server::xmlrpc_debugmsg("Found $max array elements");
268 for ($i = 0; $i < $max; $i++) {
269 $rec = $sno->arraymem($i);
270 if ($rec->kindOf() != "struct") {
271 $err = "Found non-struct in array at element $i";
274 // extract name and age from struct
275 $n = $rec->structmem("name");
276 $a = $rec->structmem("age");
277 // $n and $a are xmlrpcvals,
278 // so get the scalarval from them
279 $agar[$n->scalarval()] = $a->scalarval();
282 $agesorter_arr = $agar;
283 // hack, must make global as uksort() won't
284 // allow us to pass any other auxiliary information
285 uksort($agesorter_arr, 'agesorter_compare');
287 while (list($key, $val) = each($agesorter_arr)) {
288 // recreate each struct element
289 $outAr[] = new Value(array("name" => new Value($key),
290 "age" => new Value($val, "int"),), "struct");
292 // add this array to the output value
293 $v->addArray($outAr);
296 return new PhpXmlRpc\Response(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser, $err);
298 return new PhpXmlRpc\Response($v);
302 // signature and instructions, place these in the dispatch
304 $mailsend_sig = array(array(
305 Value::$xmlrpcBoolean, Value::$xmlrpcString, Value::$xmlrpcString,
306 Value::$xmlrpcString, Value::$xmlrpcString, Value::$xmlrpcString,
307 Value::$xmlrpcString, Value::$xmlrpcString,
310 $mailsend_doc = 'mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/>
311 recipient, cc, and bcc are strings, comma-separated lists of email addresses, as described above.<br/>
312 subject is a string, the subject of the message.<br/>
313 sender is a string, it\'s the email address of the person sending the message. This string can not be
314 a comma-separated list, it must contain a single email address only.<br/>
315 text is a string, it contains the body of the message.<br/>
316 mimetype, a string, is a standard MIME type, for example, text/plain.
318 // WARNING; this functionality depends on the sendmail -t option
319 // it may not work with Windows machines properly; particularly
320 // the Bcc option. Sneak on your friends at your own risk!
321 function mailSend($m)
325 $mTo = $m->getParam(0);
326 $mSub = $m->getParam(1);
327 $mBody = $m->getParam(2);
328 $mFrom = $m->getParam(3);
329 $mCc = $m->getParam(4);
330 $mBcc = $m->getParam(5);
331 $mMime = $m->getParam(6);
333 if ($mTo->scalarval() == "") {
334 $err = "Error, no 'To' field specified";
337 if ($mFrom->scalarval() == "") {
338 $err = "Error, no 'From' field specified";
341 $msghdr = "From: " . $mFrom->scalarval() . "\n";
342 $msghdr .= "To: " . $mTo->scalarval() . "\n";
344 if ($mCc->scalarval() != "") {
345 $msghdr .= "Cc: " . $mCc->scalarval() . "\n";
347 if ($mBcc->scalarval() != "") {
348 $msghdr .= "Bcc: " . $mBcc->scalarval() . "\n";
350 if ($mMime->scalarval() != "") {
351 $msghdr .= "Content-type: " . $mMime->scalarval() . "\n";
353 $msghdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
361 $err = "Error, could not send the mail.";
366 return new PhpXmlRpc\Response(0, PhpXmlRpc\PhpXmlRpc::$xmlrpcerruser, $err);
368 return new PhpXmlRpc\Response(new Value("true", Value::$xmlrpcBoolean));
372 $getallheaders_sig = array(array(Value::$xmlrpcStruct));
373 $getallheaders_doc = 'Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS';
374 function getallheaders_xmlrpc($m)
376 $encoder = new PhpXmlRpc\Encoder();
378 if (function_exists('getallheaders')) {
379 return new PhpXmlRpc\Response($encoder->encode(getallheaders()));
382 // IIS: poor man's version of getallheaders
383 foreach ($_SERVER as $key => $val) {
384 if (strpos($key, 'HTTP_') === 0) {
385 $key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5))));
386 $headers[$key] = $val;
390 return new PhpXmlRpc\Response($encoder->encode($headers));
394 $setcookies_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcStruct));
395 $setcookies_doc = 'Sends to client a response containing a single \'1\' digit, and sets to it http cookies as received in the request (array of structs describing a cookie)';
396 function setCookies($m)
398 $encoder = new PhpXmlRpc\Encoder();
399 $m = $m->getParam(0);
400 while (list($name, $value) = $m->structeach()) {
401 $cookieDesc = $encoder->decode($value);
402 setcookie($name, @$cookieDesc['value'], @$cookieDesc['expires'], @$cookieDesc['path'], @$cookieDesc['domain'], @$cookieDesc['secure']);
405 return new PhpXmlRpc\Response(new Value(1, 'int'));
408 $getcookies_sig = array(array(Value::$xmlrpcStruct));
409 $getcookies_doc = 'Sends to client a response containing all http cookies as received in the request (as struct)';
410 function getCookies($m)
412 $encoder = new PhpXmlRpc\Encoder();
413 return new PhpXmlRpc\Response($encoder->encode($_COOKIE));
416 $v1_arrayOfStructs_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcArray));
417 $v1_arrayOfStructs_doc = 'This handler takes a single parameter, an array of structs, each of which contains at least three elements named moe, larry and curly, all <i4>s. Your handler must add all the struct elements named curly and return the result.';
418 function v1_arrayOfStructs($m)
420 $sno = $m->getParam(0);
422 for ($i = 0; $i < $sno->arraysize(); $i++) {
423 $str = $sno->arraymem($i);
425 while (list($key, $val) = $str->structeach()) {
426 if ($key == "curly") {
427 $numCurly += $val->scalarval();
432 return new PhpXmlRpc\Response(new Value($numCurly, "int"));
435 $v1_easyStruct_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcStruct));
436 $v1_easyStruct_doc = 'This handler takes a single parameter, a struct, containing at least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.';
437 function v1_easyStruct($m)
439 $sno = $m->getParam(0);
440 $moe = $sno->structmem("moe");
441 $larry = $sno->structmem("larry");
442 $curly = $sno->structmem("curly");
443 $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval();
445 return new PhpXmlRpc\Response(new Value($num, "int"));
448 $v1_echoStruct_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcStruct));
449 $v1_echoStruct_doc = 'This handler takes a single parameter, a struct. Your handler must return the struct.';
450 function v1_echoStruct($m)
452 $sno = $m->getParam(0);
454 return new PhpXmlRpc\Response($sno);
457 $v1_manyTypes_sig = array(array(
458 Value::$xmlrpcArray, Value::$xmlrpcInt, Value::$xmlrpcBoolean,
459 Value::$xmlrpcString, Value::$xmlrpcDouble, Value::$xmlrpcDateTime,
460 Value::$xmlrpcBase64,
462 $v1_manyTypes_doc = 'This handler takes six parameters, and returns an array containing all the parameters.';
463 function v1_manyTypes($m)
465 return new PhpXmlRpc\Response(new Value(array(
476 $v1_moderateSizeArrayCheck_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcArray));
477 $v1_moderateSizeArrayCheck_doc = 'This handler takes a single parameter, which is an array containing between 100 and 200 elements. Each of the items is a string, your handler must return a string containing the concatenated text of the first and last elements.';
478 function v1_moderateSizeArrayCheck($m)
480 $ar = $m->getParam(0);
481 $sz = $ar->arraysize();
482 $first = $ar->arraymem(0);
483 $last = $ar->arraymem($sz - 1);
485 return new PhpXmlRpc\Response(new Value($first->scalarval() .
486 $last->scalarval(), "string"));
489 $v1_simpleStructReturn_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcInt));
490 $v1_simpleStructReturn_doc = 'This handler takes one parameter, and returns a struct containing three elements, times10, times100 and times1000, the result of multiplying the number by 10, 100 and 1000.';
491 function v1_simpleStructReturn($m)
493 $sno = $m->getParam(0);
494 $v = $sno->scalarval();
496 return new PhpXmlRpc\Response(new Value(array(
497 "times10" => new Value($v * 10, "int"),
498 "times100" => new Value($v * 100, "int"),
499 "times1000" => new Value($v * 1000, "int"),),
504 $v1_nestedStruct_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcStruct));
505 $v1_nestedStruct_doc = 'This handler takes a single parameter, a struct, that models a daily calendar. At the top level, there is one struct for each year. Each year is broken down into months, and months into days. Most of the days are empty in the struct you receive, but the entry for April 1, 2000 contains a least three elements named moe, larry and curly, all <i4>s. Your handler must add the three numbers and return the result.';
506 function v1_nestedStruct($m)
508 $sno = $m->getParam(0);
510 $twoK = $sno->structmem("2000");
511 $april = $twoK->structmem("04");
512 $fools = $april->structmem("01");
513 $curly = $fools->structmem("curly");
514 $larry = $fools->structmem("larry");
515 $moe = $fools->structmem("moe");
517 return new PhpXmlRpc\Response(new Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int"));
520 $v1_countTheEntities_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcString));
521 $v1_countTheEntities_doc = 'This handler takes a single parameter, a string, that contains any number of predefined entities, namely <, >, & \' and ".<BR>Your handler must return a struct that contains five fields, all numbers: ctLeftAngleBrackets, ctRightAngleBrackets, ctAmpersands, ctApostrophes, ctQuotes.';
522 function v1_countTheEntities($m)
524 $sno = $m->getParam(0);
525 $str = $sno->scalarval();
531 for ($i = 0; $i < strlen($str); $i++) {
532 $c = substr($str, $i, 1);
554 return new PhpXmlRpc\Response(new Value(array(
555 "ctLeftAngleBrackets" => new Value($lt, "int"),
556 "ctRightAngleBrackets" => new Value($gt, "int"),
557 "ctAmpersands" => new Value($amp, "int"),
558 "ctApostrophes" => new Value($ap, "int"),
559 "ctQuotes" => new Value($qu, "int"),),
564 // trivial interop tests
565 // http://www.xmlrpc.com/stories/storyReader$1636
567 $i_echoString_sig = array(array(Value::$xmlrpcString, Value::$xmlrpcString));
568 $i_echoString_doc = "Echoes string.";
570 $i_echoStringArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
571 $i_echoStringArray_doc = "Echoes string array.";
573 $i_echoInteger_sig = array(array(Value::$xmlrpcInt, Value::$xmlrpcInt));
574 $i_echoInteger_doc = "Echoes integer.";
576 $i_echoIntegerArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
577 $i_echoIntegerArray_doc = "Echoes integer array.";
579 $i_echoFloat_sig = array(array(Value::$xmlrpcDouble, Value::$xmlrpcDouble));
580 $i_echoFloat_doc = "Echoes float.";
582 $i_echoFloatArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
583 $i_echoFloatArray_doc = "Echoes float array.";
585 $i_echoStruct_sig = array(array(Value::$xmlrpcStruct, Value::$xmlrpcStruct));
586 $i_echoStruct_doc = "Echoes struct.";
588 $i_echoStructArray_sig = array(array(Value::$xmlrpcArray, Value::$xmlrpcArray));
589 $i_echoStructArray_doc = "Echoes struct array.";
591 $i_echoValue_doc = "Echoes any value back.";
592 $i_echoValue_sig = array(array(Value::$xmlrpcValue, Value::$xmlrpcValue));
594 $i_echoBase64_sig = array(array(Value::$xmlrpcBase64, Value::$xmlrpcBase64));
595 $i_echoBase64_doc = "Echoes base64.";
597 $i_echoDate_sig = array(array(Value::$xmlrpcDateTime, Value::$xmlrpcDateTime));
598 $i_echoDate_doc = "Echoes dateTime.";
600 function i_echoParam($m)
602 $s = $m->getParam(0);
604 return new PhpXmlRpc\Response($s);
607 function i_echoString($m)
609 return i_echoParam($m);
612 function i_echoInteger($m)
614 return i_echoParam($m);
617 function i_echoFloat($m)
619 return i_echoParam($m);
622 function i_echoStruct($m)
624 return i_echoParam($m);
627 function i_echoStringArray($m)
629 return i_echoParam($m);
632 function i_echoIntegerArray($m)
634 return i_echoParam($m);
637 function i_echoFloatArray($m)
639 return i_echoParam($m);
642 function i_echoStructArray($m)
644 return i_echoParam($m);
647 function i_echoValue($m)
649 return i_echoParam($m);
652 function i_echoBase64($m)
654 return i_echoParam($m);
657 function i_echoDate($m)
659 return i_echoParam($m);
662 $i_whichToolkit_sig = array(array(Value::$xmlrpcStruct));
663 $i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem.";
665 function i_whichToolkit($m)
667 global $SERVER_SOFTWARE;
669 "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/",
670 "toolkitName" => PhpXmlRpc\PhpXmlRpc::$xmlrpcName,
671 "toolkitVersion" => PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion,
672 "toolkitOperatingSystem" => isset($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'],
675 $encoder = new PhpXmlRpc\Encoder();
676 return new PhpXmlRpc\Response($encoder->encode($ret));
679 $object = new xmlrpcServerMethodsContainer();
681 "examples.getStateName" => array(
682 "function" => "findState",
683 "signature" => $findstate_sig,
684 "docstring" => $findstate_doc,
686 "examples.sortByAge" => array(
687 "function" => "ageSorter",
688 "signature" => $agesorter_sig,
689 "docstring" => $agesorter_doc,
691 "examples.addtwo" => array(
692 "function" => "addTwo",
693 "signature" => $addtwo_sig,
694 "docstring" => $addtwo_doc,
696 "examples.addtwodouble" => array(
697 "function" => "addTwoDouble",
698 "signature" => $addtwodouble_sig,
699 "docstring" => $addtwodouble_doc,
701 "examples.stringecho" => array(
702 "function" => "stringEcho",
703 "signature" => $stringecho_sig,
704 "docstring" => $stringecho_doc,
706 "examples.echo" => array(
707 "function" => "echoBack",
708 "signature" => $echoback_sig,
709 "docstring" => $echoback_doc,
711 "examples.decode64" => array(
712 "function" => "echoSixtyFour",
713 "signature" => $echosixtyfour_sig,
714 "docstring" => $echosixtyfour_doc,
716 "examples.invertBooleans" => array(
717 "function" => "bitFlipper",
718 "signature" => $bitflipper_sig,
719 "docstring" => $bitflipper_doc,
721 // signature omitted on purpose
722 "examples.generatePHPWarning" => array(
723 "function" => array($object, "phpWarningGenerator"),
725 // signature omitted on purpose
726 "examples.raiseException" => array(
727 "function" => array($object, "exceptionGenerator"),
729 "examples.getallheaders" => array(
730 "function" => 'getallheaders_xmlrpc',
731 "signature" => $getallheaders_sig,
732 "docstring" => $getallheaders_doc,
734 "examples.setcookies" => array(
735 "function" => 'setCookies',
736 "signature" => $setcookies_sig,
737 "docstring" => $setcookies_doc,
739 "examples.getcookies" => array(
740 "function" => 'getCookies',
741 "signature" => $getcookies_sig,
742 "docstring" => $getcookies_doc,
744 "mail.send" => array(
745 "function" => "mailSend",
746 "signature" => $mailsend_sig,
747 "docstring" => $mailsend_doc,
749 "validator1.arrayOfStructsTest" => array(
750 "function" => "v1_arrayOfStructs",
751 "signature" => $v1_arrayOfStructs_sig,
752 "docstring" => $v1_arrayOfStructs_doc,
754 "validator1.easyStructTest" => array(
755 "function" => "v1_easyStruct",
756 "signature" => $v1_easyStruct_sig,
757 "docstring" => $v1_easyStruct_doc,
759 "validator1.echoStructTest" => array(
760 "function" => "v1_echoStruct",
761 "signature" => $v1_echoStruct_sig,
762 "docstring" => $v1_echoStruct_doc,
764 "validator1.manyTypesTest" => array(
765 "function" => "v1_manyTypes",
766 "signature" => $v1_manyTypes_sig,
767 "docstring" => $v1_manyTypes_doc,
769 "validator1.moderateSizeArrayCheck" => array(
770 "function" => "v1_moderateSizeArrayCheck",
771 "signature" => $v1_moderateSizeArrayCheck_sig,
772 "docstring" => $v1_moderateSizeArrayCheck_doc,
774 "validator1.simpleStructReturnTest" => array(
775 "function" => "v1_simpleStructReturn",
776 "signature" => $v1_simpleStructReturn_sig,
777 "docstring" => $v1_simpleStructReturn_doc,
779 "validator1.nestedStructTest" => array(
780 "function" => "v1_nestedStruct",
781 "signature" => $v1_nestedStruct_sig,
782 "docstring" => $v1_nestedStruct_doc,
784 "validator1.countTheEntities" => array(
785 "function" => "v1_countTheEntities",
786 "signature" => $v1_countTheEntities_sig,
787 "docstring" => $v1_countTheEntities_doc,
789 "interopEchoTests.echoString" => array(
790 "function" => "i_echoString",
791 "signature" => $i_echoString_sig,
792 "docstring" => $i_echoString_doc,
794 "interopEchoTests.echoStringArray" => array(
795 "function" => "i_echoStringArray",
796 "signature" => $i_echoStringArray_sig,
797 "docstring" => $i_echoStringArray_doc,
799 "interopEchoTests.echoInteger" => array(
800 "function" => "i_echoInteger",
801 "signature" => $i_echoInteger_sig,
802 "docstring" => $i_echoInteger_doc,
804 "interopEchoTests.echoIntegerArray" => array(
805 "function" => "i_echoIntegerArray",
806 "signature" => $i_echoIntegerArray_sig,
807 "docstring" => $i_echoIntegerArray_doc,
809 "interopEchoTests.echoFloat" => array(
810 "function" => "i_echoFloat",
811 "signature" => $i_echoFloat_sig,
812 "docstring" => $i_echoFloat_doc,
814 "interopEchoTests.echoFloatArray" => array(
815 "function" => "i_echoFloatArray",
816 "signature" => $i_echoFloatArray_sig,
817 "docstring" => $i_echoFloatArray_doc,
819 "interopEchoTests.echoStruct" => array(
820 "function" => "i_echoStruct",
821 "signature" => $i_echoStruct_sig,
822 "docstring" => $i_echoStruct_doc,
824 "interopEchoTests.echoStructArray" => array(
825 "function" => "i_echoStructArray",
826 "signature" => $i_echoStructArray_sig,
827 "docstring" => $i_echoStructArray_doc,
829 "interopEchoTests.echoValue" => array(
830 "function" => "i_echoValue",
831 "signature" => $i_echoValue_sig,
832 "docstring" => $i_echoValue_doc,
834 "interopEchoTests.echoBase64" => array(
835 "function" => "i_echoBase64",
836 "signature" => $i_echoBase64_sig,
837 "docstring" => $i_echoBase64_doc,
839 "interopEchoTests.echoDate" => array(
840 "function" => "i_echoDate",
841 "signature" => $i_echoDate_sig,
842 "docstring" => $i_echoDate_doc,
844 "interopEchoTests.whichToolkit" => array(
845 "function" => "i_whichToolkit",
846 "signature" => $i_whichToolkit_sig,
847 "docstring" => $i_whichToolkit_doc,
851 if ($findstate2_sig) {
852 $signatures['examples.php.getStateName'] = $findstate2_sig;
855 if ($findstate3_sig) {
856 $signatures['examples.php2.getStateName'] = $findstate3_sig;
859 if ($findstate4_sig) {
860 $signatures['examples.php3.getStateName'] = $findstate4_sig;
863 if ($findstate5_sig) {
864 $signatures['examples.php4.getStateName'] = $findstate5_sig;
867 $s = new PhpXmlRpc\Server($signatures, false);
869 $s->compress_response = true;
871 // out-of-band information: let the client manipulate the server operations.
872 // we do this to help the testsuite script: do not reproduce in production!
873 if (isset($_GET['RESPONSE_ENCODING'])) {
874 $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
876 if (isset($_GET['EXCEPTION_HANDLING'])) {
877 $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
880 // that should do all we need!
882 // out-of-band information: let the client manipulate the server operations.
883 // we do this to help the testsuite script: do not reproduce in production!
884 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
885 include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";