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";
31 include_once __DIR__ . "/../../lib/xmlrpc.inc";
32 include_once __DIR__ . "/../../lib/xmlrpcs.inc";
33 include_once __DIR__ . "/../../lib/xmlrpc_wrappers.inc";
36 * Used to test usage of object methods in dispatch maps and in wrapper code.
38 class xmlrpc_server_methods_container
41 * Method used to test logging of php warnings generated by user functions.
43 public function phpwarninggenerator($m)
45 $a = $b; // this triggers a warning in E_ALL mode, since $b is undefined
46 return new PhpXmlRpc\Response(new PhpXmlRpc\Value(1, 'boolean'));
50 * Method used to test catching of exceptions in the server.
52 public function exceptiongenerator($m)
54 throw new Exception("it's just a test", 1);
58 * a PHP version of the state-number server. Send me an integer and i'll sell you a state
62 public static function findstate($s)
64 return inner_findstate($s);
69 // of the state-number server
70 // send me an integer and i'll sell you a state
73 "Alabama", "Alaska", "Arizona", "Arkansas", "California",
74 "Colorado", "Columbia", "Connecticut", "Delaware", "Florida",
75 "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas",
76 "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan",
77 "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada",
78 "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina",
79 "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
80 "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont",
81 "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming",
84 $findstate_sig = array(array($xmlrpcString, $xmlrpcInt));
85 $findstate_doc = 'When passed an integer between 1 and 51 returns the
86 name of a US state, where the integer is the index of that state name
87 in an alphabetic order.';
89 function findstate($m)
91 global $xmlrpcerruser, $stateNames;
93 // get the first param
94 $sno = $m->getParam(0);
96 // param must be there and of the correct type: server object does the
99 // extract the value of the state number
100 $snv = $sno->scalarval();
101 // look it up in our array (zero-based)
102 if (isset($stateNames[$snv - 1])) {
103 $sname = $stateNames[$snv - 1];
105 // not, there so complain
106 $err = "I don't have a state for the index '" . $snv . "'";
109 // if we generated an error, create an error return response
111 return new PhpXmlRpc\Response(0, $xmlrpcerruser, $err);
113 // otherwise, we create the right response
114 // with the state name
115 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($sname));
120 * Inner code of the state-number server.
121 * Used to test auto-registration of PHP funcions as xmlrpc methods.
123 * @param integer $stateno the state number
125 * @return string the name of the state (or error descrption)
127 function inner_findstate($stateno)
130 if (isset($stateNames[$stateno - 1])) {
131 return $stateNames[$stateno - 1];
133 // not, there so complain
134 return "I don't have a state for the index '" . $stateno . "'";
138 $findstate2_sig = wrap_php_function('inner_findstate');
140 $findstate3_sig = wrap_php_function(array('xmlrpc_server_methods_container', 'findstate'));
142 $findstate5_sig = wrap_php_function('xmlrpc_server_methods_container::findstate');
144 $obj = new PhpXmlRpc\Server_methods_container();
145 $findstate4_sig = wrap_php_function(array($obj, 'findstate'));
147 $addtwo_sig = array(array($xmlrpcInt, $xmlrpcInt, $xmlrpcInt));
148 $addtwo_doc = 'Add two integers together and return the result';
151 $s = $m->getParam(0);
152 $t = $m->getParam(1);
154 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($s->scalarval() + $t->scalarval(), "int"));
157 $addtwodouble_sig = array(array($xmlrpcDouble, $xmlrpcDouble, $xmlrpcDouble));
158 $addtwodouble_doc = 'Add two doubles together and return the result';
159 function addtwodouble($m)
161 $s = $m->getParam(0);
162 $t = $m->getParam(1);
164 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($s->scalarval() + $t->scalarval(), "double"));
167 $stringecho_sig = array(array($xmlrpcString, $xmlrpcString));
168 $stringecho_doc = 'Accepts a string parameter, returns the string.';
169 function stringecho($m)
171 // just sends back a string
172 $s = $m->getParam(0);
173 $v = $s->scalarval();
175 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($s->scalarval()));
178 $echoback_sig = array(array($xmlrpcString, $xmlrpcString));
179 $echoback_doc = 'Accepts a string parameter, returns the entire incoming payload';
180 function echoback($m)
182 // just sends back a string with what i got
183 // sent to me, just escaped, that's all
185 // $m is an incoming message
186 $s = "I got the following message:\n" . $m->serialize();
188 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($s));
191 $echosixtyfour_sig = array(array($xmlrpcString, $xmlrpcBase64));
192 $echosixtyfour_doc = 'Accepts a base64 parameter and returns it decoded as a string';
193 function echosixtyfour($m)
195 // accepts an encoded value, but sends it back
196 // as a normal string. this is to test base64 encoding
197 // is working as expected
198 $incoming = $m->getParam(0);
200 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($incoming->scalarval(), "string"));
203 $bitflipper_sig = array(array($xmlrpcArray, $xmlrpcArray));
204 $bitflipper_doc = 'Accepts an array of booleans, and returns them inverted';
205 function bitflipper($m)
209 $v = $m->getParam(0);
210 $sz = $v->arraysize();
211 $rv = new PhpXmlRpc\Value(array(), $xmlrpcArray);
213 for ($j = 0; $j < $sz; $j++) {
214 $b = $v->arraymem($j);
215 if ($b->scalarval()) {
216 $rv->addScalar(false, "boolean");
218 $rv->addScalar(true, "boolean");
222 return new PhpXmlRpc\Response($rv);
227 // send me an array of structs thus:
234 // and I'll return it to you in sorted order
236 function agesorter_compare($a, $b)
238 global $agesorter_arr;
240 // don't even ask me _why_ these come padded with
241 // hyphens, I couldn't tell you :p
242 $a = str_replace("-", "", $a);
243 $b = str_replace("-", "", $b);
245 if ($agesorter_arr[$a] == $agesorter_arr[$b]) {
249 return ($agesorter_arr[$a] > $agesorter_arr[$b]) ? -1 : 1;
252 $agesorter_sig = array(array($xmlrpcArray, $xmlrpcArray));
253 $agesorter_doc = 'Send this method an array of [string, int] structs, eg:
260 And the array will be returned with the entries sorted by their numbers.
262 function agesorter($m)
264 global $agesorter_arr, $xmlrpcerruser, $s;
266 xmlrpc_debugmsg("Entering 'agesorter'");
268 $sno = $m->getParam(0);
269 // error string for [if|when] things go wrong
271 // create the output value
272 $v = new PhpXmlRpc\Value();
275 if (isset($sno) && $sno->kindOf() == "array") {
276 $max = $sno->arraysize();
277 // TODO: create debug method to print can work once more
278 // print "<!-- found $max array elements -->\n";
279 for ($i = 0; $i < $max; $i++) {
280 $rec = $sno->arraymem($i);
281 if ($rec->kindOf() != "struct") {
282 $err = "Found non-struct in array at element $i";
285 // extract name and age from struct
286 $n = $rec->structmem("name");
287 $a = $rec->structmem("age");
288 // $n and $a are xmlrpcvals,
289 // so get the scalarval from them
290 $agar[$n->scalarval()] = $a->scalarval();
293 $agesorter_arr = $agar;
294 // hack, must make global as uksort() won't
295 // allow us to pass any other auxilliary information
296 uksort($agesorter_arr, agesorter_compare);
298 while (list($key, $val) = each($agesorter_arr)) {
299 // recreate each struct element
300 $outAr[] = new PhpXmlRpc\Value(array("name" => new PhpXmlRpc\Value($key),
301 "age" => new PhpXmlRpc\Value($val, "int"),), "struct");
303 // add this array to the output value
304 $v->addArray($outAr);
306 $err = "Must be one parameter, an array of structs";
310 return new PhpXmlRpc\Response(0, $xmlrpcerruser, $err);
312 return new PhpXmlRpc\Response($v);
316 // signature and instructions, place these in the dispatch
318 $mail_send_sig = array(array(
319 $xmlrpcBoolean, $xmlrpcString, $xmlrpcString,
320 $xmlrpcString, $xmlrpcString, $xmlrpcString,
321 $xmlrpcString, $xmlrpcString,
324 $mail_send_doc = 'mail.send(recipient, subject, text, sender, cc, bcc, mimetype)<br/>
325 recipient, cc, and bcc are strings, comma-separated lists of email addresses, as described above.<br/>
326 subject is a string, the subject of the message.<br/>
327 sender is a string, it\'s the email address of the person sending the message. This string can not be
328 a comma-separated list, it must contain a single email address only.<br/>
329 text is a string, it contains the body of the message.<br/>
330 mimetype, a string, is a standard MIME type, for example, text/plain.
332 // WARNING; this functionality depends on the sendmail -t option
333 // it may not work with Windows machines properly; particularly
334 // the Bcc option. Sneak on your friends at your own risk!
335 function mail_send($m)
337 global $xmlrpcerruser, $xmlrpcBoolean;
340 $mTo = $m->getParam(0);
341 $mSub = $m->getParam(1);
342 $mBody = $m->getParam(2);
343 $mFrom = $m->getParam(3);
344 $mCc = $m->getParam(4);
345 $mBcc = $m->getParam(5);
346 $mMime = $m->getParam(6);
348 if ($mTo->scalarval() == "") {
349 $err = "Error, no 'To' field specified";
352 if ($mFrom->scalarval() == "") {
353 $err = "Error, no 'From' field specified";
356 $msghdr = "From: " . $mFrom->scalarval() . "\n";
357 $msghdr .= "To: " . $mTo->scalarval() . "\n";
359 if ($mCc->scalarval() != "") {
360 $msghdr .= "Cc: " . $mCc->scalarval() . "\n";
362 if ($mBcc->scalarval() != "") {
363 $msghdr .= "Bcc: " . $mBcc->scalarval() . "\n";
365 if ($mMime->scalarval() != "") {
366 $msghdr .= "Content-type: " . $mMime->scalarval() . "\n";
368 $msghdr .= "X-Mailer: XML-RPC for PHP mailer 1.0";
376 $err = "Error, could not send the mail.";
381 return new PhpXmlRpc\Response(0, $xmlrpcerruser, $err);
383 return new PhpXmlRpc\Response(new PhpXmlRpc\Value("true", $xmlrpcBoolean));
387 $getallheaders_sig = array(array($xmlrpcStruct));
388 $getallheaders_doc = 'Returns a struct containing all the HTTP headers received with the request. Provides limited functionality with IIS';
389 function getallheaders_xmlrpc($m)
391 global $xmlrpcerruser;
392 if (function_exists('getallheaders')) {
393 return new PhpXmlRpc\Response(php_xmlrpc_encode(getallheaders()));
396 // IIS: poor man's version of getallheaders
397 foreach ($_SERVER as $key => $val) {
398 if (strpos($key, 'HTTP_') === 0) {
399 $key = ucfirst(str_replace('_', '-', strtolower(substr($key, 5))));
400 $headers[$key] = $val;
404 return new PhpXmlRpc\Response(php_xmlrpc_encode($headers));
408 $setcookies_sig = array(array($xmlrpcInt, $xmlrpcStruct));
409 $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)';
410 function setcookies($m)
412 $m = $m->getParam(0);
413 while (list($name, $value) = $m->structeach()) {
414 $cookiedesc = php_xmlrpc_decode($value);
415 setcookie($name, @$cookiedesc['value'], @$cookiedesc['expires'], @$cookiedesc['path'], @$cookiedesc['domain'], @$cookiedesc['secure']);
418 return new PhpXmlRpc\Response(new PhpXmlRpc\Value(1, 'int'));
421 $getcookies_sig = array(array($xmlrpcStruct));
422 $getcookies_doc = 'Sends to client a response containing all http cookies as received in the request (as struct)';
423 function getcookies($m)
425 return new PhpXmlRpc\Response(php_xmlrpc_encode($_COOKIE));
428 $v1_arrayOfStructs_sig = array(array($xmlrpcInt, $xmlrpcArray));
429 $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.';
430 function v1_arrayOfStructs($m)
432 $sno = $m->getParam(0);
434 for ($i = 0; $i < $sno->arraysize(); $i++) {
435 $str = $sno->arraymem($i);
437 while (list($key, $val) = $str->structeach()) {
438 if ($key == "curly") {
439 $numcurly += $val->scalarval();
444 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($numcurly, "int"));
447 $v1_easyStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct));
448 $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.';
449 function v1_easyStruct($m)
451 $sno = $m->getParam(0);
452 $moe = $sno->structmem("moe");
453 $larry = $sno->structmem("larry");
454 $curly = $sno->structmem("curly");
455 $num = $moe->scalarval() + $larry->scalarval() + $curly->scalarval();
457 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($num, "int"));
460 $v1_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct));
461 $v1_echoStruct_doc = 'This handler takes a single parameter, a struct. Your handler must return the struct.';
462 function v1_echoStruct($m)
464 $sno = $m->getParam(0);
466 return new PhpXmlRpc\Response($sno);
469 $v1_manyTypes_sig = array(array(
470 $xmlrpcArray, $xmlrpcInt, $xmlrpcBoolean,
471 $xmlrpcString, $xmlrpcDouble, $xmlrpcDateTime,
474 $v1_manyTypes_doc = 'This handler takes six parameters, and returns an array containing all the parameters.';
475 function v1_manyTypes($m)
477 return new PhpXmlRpc\Response(new PhpXmlRpc\Value(array(
488 $v1_moderateSizeArrayCheck_sig = array(array($xmlrpcString, $xmlrpcArray));
489 $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.';
490 function v1_moderateSizeArrayCheck($m)
492 $ar = $m->getParam(0);
493 $sz = $ar->arraysize();
494 $first = $ar->arraymem(0);
495 $last = $ar->arraymem($sz - 1);
497 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($first->scalarval() .
498 $last->scalarval(), "string"));
501 $v1_simpleStructReturn_sig = array(array($xmlrpcStruct, $xmlrpcInt));
502 $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.';
503 function v1_simpleStructReturn($m)
505 $sno = $m->getParam(0);
506 $v = $sno->scalarval();
508 return new PhpXmlRpc\Response(new PhpXmlRpc\Value(array(
509 "times10" => new PhpXmlRpc\Value($v * 10, "int"),
510 "times100" => new PhpXmlRpc\Value($v * 100, "int"),
511 "times1000" => new PhpXmlRpc\Value($v * 1000, "int"),),
516 $v1_nestedStruct_sig = array(array($xmlrpcInt, $xmlrpcStruct));
517 $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.';
518 function v1_nestedStruct($m)
520 $sno = $m->getParam(0);
522 $twoK = $sno->structmem("2000");
523 $april = $twoK->structmem("04");
524 $fools = $april->structmem("01");
525 $curly = $fools->structmem("curly");
526 $larry = $fools->structmem("larry");
527 $moe = $fools->structmem("moe");
529 return new PhpXmlRpc\Response(new PhpXmlRpc\Value($curly->scalarval() + $larry->scalarval() + $moe->scalarval(), "int"));
532 $v1_countTheEntities_sig = array(array($xmlrpcStruct, $xmlrpcString));
533 $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.';
534 function v1_countTheEntities($m)
536 $sno = $m->getParam(0);
537 $str = $sno->scalarval();
543 for ($i = 0; $i < strlen($str); $i++) {
544 $c = substr($str, $i, 1);
566 return new PhpXmlRpc\Response(new PhpXmlRpc\Value(array(
567 "ctLeftAngleBrackets" => new PhpXmlRpc\Value($lt, "int"),
568 "ctRightAngleBrackets" => new PhpXmlRpc\Value($gt, "int"),
569 "ctAmpersands" => new PhpXmlRpc\Value($amp, "int"),
570 "ctApostrophes" => new PhpXmlRpc\Value($ap, "int"),
571 "ctQuotes" => new PhpXmlRpc\Value($qu, "int"),),
576 // trivial interop tests
577 // http://www.xmlrpc.com/stories/storyReader$1636
579 $i_echoString_sig = array(array($xmlrpcString, $xmlrpcString));
580 $i_echoString_doc = "Echoes string.";
582 $i_echoStringArray_sig = array(array($xmlrpcArray, $xmlrpcArray));
583 $i_echoStringArray_doc = "Echoes string array.";
585 $i_echoInteger_sig = array(array($xmlrpcInt, $xmlrpcInt));
586 $i_echoInteger_doc = "Echoes integer.";
588 $i_echoIntegerArray_sig = array(array($xmlrpcArray, $xmlrpcArray));
589 $i_echoIntegerArray_doc = "Echoes integer array.";
591 $i_echoFloat_sig = array(array($xmlrpcDouble, $xmlrpcDouble));
592 $i_echoFloat_doc = "Echoes float.";
594 $i_echoFloatArray_sig = array(array($xmlrpcArray, $xmlrpcArray));
595 $i_echoFloatArray_doc = "Echoes float array.";
597 $i_echoStruct_sig = array(array($xmlrpcStruct, $xmlrpcStruct));
598 $i_echoStruct_doc = "Echoes struct.";
600 $i_echoStructArray_sig = array(array($xmlrpcArray, $xmlrpcArray));
601 $i_echoStructArray_doc = "Echoes struct array.";
603 $i_echoValue_doc = "Echoes any value back.";
604 $i_echoValue_sig = array(array($xmlrpcValue, $xmlrpcValue));
606 $i_echoBase64_sig = array(array($xmlrpcBase64, $xmlrpcBase64));
607 $i_echoBase64_doc = "Echoes base64.";
609 $i_echoDate_sig = array(array($xmlrpcDateTime, $xmlrpcDateTime));
610 $i_echoDate_doc = "Echoes dateTime.";
612 function i_echoParam($m)
614 $s = $m->getParam(0);
616 return new PhpXmlRpc\Response($s);
619 function i_echoString($m)
621 return i_echoParam($m);
624 function i_echoInteger($m)
626 return i_echoParam($m);
629 function i_echoFloat($m)
631 return i_echoParam($m);
634 function i_echoStruct($m)
636 return i_echoParam($m);
639 function i_echoStringArray($m)
641 return i_echoParam($m);
644 function i_echoIntegerArray($m)
646 return i_echoParam($m);
649 function i_echoFloatArray($m)
651 return i_echoParam($m);
654 function i_echoStructArray($m)
656 return i_echoParam($m);
659 function i_echoValue($m)
661 return i_echoParam($m);
664 function i_echoBase64($m)
666 return i_echoParam($m);
669 function i_echoDate($m)
671 return i_echoParam($m);
674 $i_whichToolkit_sig = array(array($xmlrpcStruct));
675 $i_whichToolkit_doc = "Returns a struct containing the following strings: toolkitDocsUrl, toolkitName, toolkitVersion, toolkitOperatingSystem.";
677 function i_whichToolkit($m)
679 global $xmlrpcName, $xmlrpcVersion, $SERVER_SOFTWARE;
681 "toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/",
682 "toolkitName" => $xmlrpcName,
683 "toolkitVersion" => $xmlrpcVersion,
684 "toolkitOperatingSystem" => isset($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE'],
687 return new PhpXmlRpc\Response(php_xmlrpc_encode($ret));
690 $o = new xmlrpc_server_methods_container();
692 "examples.getStateName" => array(
693 "function" => "findstate",
694 "signature" => $findstate_sig,
695 "docstring" => $findstate_doc,
697 "examples.sortByAge" => array(
698 "function" => "agesorter",
699 "signature" => $agesorter_sig,
700 "docstring" => $agesorter_doc,
702 "examples.addtwo" => array(
703 "function" => "addtwo",
704 "signature" => $addtwo_sig,
705 "docstring" => $addtwo_doc,
707 "examples.addtwodouble" => array(
708 "function" => "addtwodouble",
709 "signature" => $addtwodouble_sig,
710 "docstring" => $addtwodouble_doc,
712 "examples.stringecho" => array(
713 "function" => "stringecho",
714 "signature" => $stringecho_sig,
715 "docstring" => $stringecho_doc,
717 "examples.echo" => array(
718 "function" => "echoback",
719 "signature" => $echoback_sig,
720 "docstring" => $echoback_doc,
722 "examples.decode64" => array(
723 "function" => "echosixtyfour",
724 "signature" => $echosixtyfour_sig,
725 "docstring" => $echosixtyfour_doc,
727 "examples.invertBooleans" => array(
728 "function" => "bitflipper",
729 "signature" => $bitflipper_sig,
730 "docstring" => $bitflipper_doc,
732 "examples.generatePHPWarning" => array(
733 "function" => array($o, "phpwarninggenerator"),
734 //'function' => 'xmlrpc_server_methods_container::phpwarninggenerator'
736 "examples.raiseException" => array(
737 "function" => array($o, "exceptiongenerator"),
739 "examples.getallheaders" => array(
740 "function" => 'getallheaders_xmlrpc',
741 "signature" => $getallheaders_sig,
742 "docstring" => $getallheaders_doc,
744 "examples.setcookies" => array(
745 "function" => 'setcookies',
746 "signature" => $setcookies_sig,
747 "docstring" => $setcookies_doc,
749 "examples.getcookies" => array(
750 "function" => 'getcookies',
751 "signature" => $getcookies_sig,
752 "docstring" => $getcookies_doc,
754 "mail.send" => array(
755 "function" => "mail_send",
756 "signature" => $mail_send_sig,
757 "docstring" => $mail_send_doc,
759 "validator1.arrayOfStructsTest" => array(
760 "function" => "v1_arrayOfStructs",
761 "signature" => $v1_arrayOfStructs_sig,
762 "docstring" => $v1_arrayOfStructs_doc,
764 "validator1.easyStructTest" => array(
765 "function" => "v1_easyStruct",
766 "signature" => $v1_easyStruct_sig,
767 "docstring" => $v1_easyStruct_doc,
769 "validator1.echoStructTest" => array(
770 "function" => "v1_echoStruct",
771 "signature" => $v1_echoStruct_sig,
772 "docstring" => $v1_echoStruct_doc,
774 "validator1.manyTypesTest" => array(
775 "function" => "v1_manyTypes",
776 "signature" => $v1_manyTypes_sig,
777 "docstring" => $v1_manyTypes_doc,
779 "validator1.moderateSizeArrayCheck" => array(
780 "function" => "v1_moderateSizeArrayCheck",
781 "signature" => $v1_moderateSizeArrayCheck_sig,
782 "docstring" => $v1_moderateSizeArrayCheck_doc,
784 "validator1.simpleStructReturnTest" => array(
785 "function" => "v1_simpleStructReturn",
786 "signature" => $v1_simpleStructReturn_sig,
787 "docstring" => $v1_simpleStructReturn_doc,
789 "validator1.nestedStructTest" => array(
790 "function" => "v1_nestedStruct",
791 "signature" => $v1_nestedStruct_sig,
792 "docstring" => $v1_nestedStruct_doc,
794 "validator1.countTheEntities" => array(
795 "function" => "v1_countTheEntities",
796 "signature" => $v1_countTheEntities_sig,
797 "docstring" => $v1_countTheEntities_doc,
799 "interopEchoTests.echoString" => array(
800 "function" => "i_echoString",
801 "signature" => $i_echoString_sig,
802 "docstring" => $i_echoString_doc,
804 "interopEchoTests.echoStringArray" => array(
805 "function" => "i_echoStringArray",
806 "signature" => $i_echoStringArray_sig,
807 "docstring" => $i_echoStringArray_doc,
809 "interopEchoTests.echoInteger" => array(
810 "function" => "i_echoInteger",
811 "signature" => $i_echoInteger_sig,
812 "docstring" => $i_echoInteger_doc,
814 "interopEchoTests.echoIntegerArray" => array(
815 "function" => "i_echoIntegerArray",
816 "signature" => $i_echoIntegerArray_sig,
817 "docstring" => $i_echoIntegerArray_doc,
819 "interopEchoTests.echoFloat" => array(
820 "function" => "i_echoFloat",
821 "signature" => $i_echoFloat_sig,
822 "docstring" => $i_echoFloat_doc,
824 "interopEchoTests.echoFloatArray" => array(
825 "function" => "i_echoFloatArray",
826 "signature" => $i_echoFloatArray_sig,
827 "docstring" => $i_echoFloatArray_doc,
829 "interopEchoTests.echoStruct" => array(
830 "function" => "i_echoStruct",
831 "signature" => $i_echoStruct_sig,
832 "docstring" => $i_echoStruct_doc,
834 "interopEchoTests.echoStructArray" => array(
835 "function" => "i_echoStructArray",
836 "signature" => $i_echoStructArray_sig,
837 "docstring" => $i_echoStructArray_doc,
839 "interopEchoTests.echoValue" => array(
840 "function" => "i_echoValue",
841 "signature" => $i_echoValue_sig,
842 "docstring" => $i_echoValue_doc,
844 "interopEchoTests.echoBase64" => array(
845 "function" => "i_echoBase64",
846 "signature" => $i_echoBase64_sig,
847 "docstring" => $i_echoBase64_doc,
849 "interopEchoTests.echoDate" => array(
850 "function" => "i_echoDate",
851 "signature" => $i_echoDate_sig,
852 "docstring" => $i_echoDate_doc,
854 "interopEchoTests.whichToolkit" => array(
855 "function" => "i_whichToolkit",
856 "signature" => $i_whichToolkit_sig,
857 "docstring" => $i_whichToolkit_doc,
861 if ($findstate2_sig) {
862 $a['examples.php.getStateName'] = $findstate2_sig;
865 if ($findstate3_sig) {
866 $a['examples.php2.getStateName'] = $findstate3_sig;
869 if ($findstate4_sig) {
870 $a['examples.php3.getStateName'] = $findstate4_sig;
873 if ($findstate5_sig) {
874 $a['examples.php4.getStateName'] = $findstate5_sig;
877 $s = new PhpXmlRpc\Server($a, false);
879 $s->compress_response = true;
881 // out-of-band information: let the client manipulate the server operations.
882 // we do this to help the testsuite script: do not reproduce in production!
883 if (isset($_GET['RESPONSE_ENCODING'])) {
884 $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
886 if (isset($_GET['EXCEPTION_HANDLING'])) {
887 $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
890 // that should do all we need!
892 // out-of-band information: let the client manipulate the server operations.
893 // we do this to help the testsuite script: do not reproduce in production!
894 if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
895 include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";