Exemplo n.º 1
0
    global $SERVER_SOFTWARE;
    $ret = array("toolkitDocsUrl" => "http://phpxmlrpc.sourceforge.net/", "toolkitName" => PhpXmlRpc\PhpXmlRpc::$xmlrpcName, "toolkitVersion" => PhpXmlRpc\PhpXmlRpc::$xmlrpcVersion, "toolkitOperatingSystem" => isset($SERVER_SOFTWARE) ? $SERVER_SOFTWARE : $_SERVER['SERVER_SOFTWARE']);
    $encoder = new PhpXmlRpc\Encoder();
    return new PhpXmlRpc\Response($encoder->encode($ret));
}
$object = new xmlrpcServerMethodsContainer();
$signatures = array("examples.getStateName" => array("function" => "findState", "signature" => $findstate_sig, "docstring" => $findstate_doc), "examples.sortByAge" => array("function" => "ageSorter", "signature" => $agesorter_sig, "docstring" => $agesorter_doc), "examples.addtwo" => array("function" => "addTwo", "signature" => $addtwo_sig, "docstring" => $addtwo_doc), "examples.addtwodouble" => array("function" => "addTwoDouble", "signature" => $addtwodouble_sig, "docstring" => $addtwodouble_doc), "examples.stringecho" => array("function" => "stringEcho", "signature" => $stringecho_sig, "docstring" => $stringecho_doc), "examples.echo" => array("function" => "echoBack", "signature" => $echoback_sig, "docstring" => $echoback_doc), "examples.decode64" => array("function" => "echoSixtyFour", "signature" => $echosixtyfour_sig, "docstring" => $echosixtyfour_doc), "examples.invertBooleans" => array("function" => "bitFlipper", "signature" => $bitflipper_sig, "docstring" => $bitflipper_doc), "tests.generatePHPWarning" => array("function" => array($object, "phpWarningGenerator")), "tests.raiseException" => array("function" => array($object, "exceptionGenerator")), "tests.utf8methodname." . 'κόσμε' => array("function" => "stringEcho", "signature" => $stringecho_sig, "docstring" => $stringecho_doc), "examples.getallheaders" => array("function" => 'getAllHeaders_xmlrpc', "signature" => $getallheaders_sig, "docstring" => $getallheaders_doc), "examples.setcookies" => array("function" => 'setCookies', "signature" => $setcookies_sig, "docstring" => $setcookies_doc), "examples.getcookies" => array("function" => 'getCookies', "signature" => $getcookies_sig, "docstring" => $getcookies_doc), "mail.send" => array("function" => "mailSend", "signature" => $mailsend_sig, "docstring" => $mailsend_doc), "validator1.arrayOfStructsTest" => array("function" => "v1_arrayOfStructs", "signature" => $v1_arrayOfStructs_sig, "docstring" => $v1_arrayOfStructs_doc), "validator1.easyStructTest" => array("function" => "v1_easyStruct", "signature" => $v1_easyStruct_sig, "docstring" => $v1_easyStruct_doc), "validator1.echoStructTest" => array("function" => "v1_echoStruct", "signature" => $v1_echoStruct_sig, "docstring" => $v1_echoStruct_doc), "validator1.manyTypesTest" => array("function" => "v1_manyTypes", "signature" => $v1_manyTypes_sig, "docstring" => $v1_manyTypes_doc), "validator1.moderateSizeArrayCheck" => array("function" => "v1_moderateSizeArrayCheck", "signature" => $v1_moderateSizeArrayCheck_sig, "docstring" => $v1_moderateSizeArrayCheck_doc), "validator1.simpleStructReturnTest" => array("function" => "v1_simpleStructReturn", "signature" => $v1_simpleStructReturn_sig, "docstring" => $v1_simpleStructReturn_doc), "validator1.nestedStructTest" => array("function" => "v1_nestedStruct", "signature" => $v1_nestedStruct_sig, "docstring" => $v1_nestedStruct_doc), "validator1.countTheEntities" => array("function" => "v1_countTheEntities", "signature" => $v1_countTheEntities_sig, "docstring" => $v1_countTheEntities_doc), "interopEchoTests.echoString" => array("function" => "i_echoString", "signature" => $i_echoString_sig, "docstring" => $i_echoString_doc), "interopEchoTests.echoStringArray" => array("function" => "i_echoStringArray", "signature" => $i_echoStringArray_sig, "docstring" => $i_echoStringArray_doc), "interopEchoTests.echoInteger" => array("function" => "i_echoInteger", "signature" => $i_echoInteger_sig, "docstring" => $i_echoInteger_doc), "interopEchoTests.echoIntegerArray" => array("function" => "i_echoIntegerArray", "signature" => $i_echoIntegerArray_sig, "docstring" => $i_echoIntegerArray_doc), "interopEchoTests.echoFloat" => array("function" => "i_echoFloat", "signature" => $i_echoFloat_sig, "docstring" => $i_echoFloat_doc), "interopEchoTests.echoFloatArray" => array("function" => "i_echoFloatArray", "signature" => $i_echoFloatArray_sig, "docstring" => $i_echoFloatArray_doc), "interopEchoTests.echoStruct" => array("function" => "i_echoStruct", "signature" => $i_echoStruct_sig, "docstring" => $i_echoStruct_doc), "interopEchoTests.echoStructArray" => array("function" => "i_echoStructArray", "signature" => $i_echoStructArray_sig, "docstring" => $i_echoStructArray_doc), "interopEchoTests.echoValue" => array("function" => "i_echoValue", "signature" => $i_echoValue_sig, "docstring" => $i_echoValue_doc), "interopEchoTests.echoBase64" => array("function" => "i_echoBase64", "signature" => $i_echoBase64_sig, "docstring" => $i_echoBase64_doc), "interopEchoTests.echoDate" => array("function" => "i_echoDate", "signature" => $i_echoDate_sig, "docstring" => $i_echoDate_doc), "interopEchoTests.whichToolkit" => array("function" => "i_whichToolkit", "signature" => $i_whichToolkit_sig, "docstring" => $i_whichToolkit_doc), 'tests.getStateName.2' => $findstate2_sig, 'tests.getStateName.3' => $findstate3_sig, 'tests.getStateName.4' => $findstate4_sig, 'tests.getStateName.5' => $findstate5_sig, 'tests.getStateName.6' => $findstate6_sig, 'tests.getStateName.7' => $findstate7_sig, 'tests.getStateName.8' => $findstate8_sig, 'tests.getStateName.9' => $findstate9_sig, 'tests.getStateName.10' => $findstate10_sig, 'tests.getStateName.11' => $findstate11_sig, 'tests.getStateName.12' => array("function" => "findStateWithNulls", "signature" => $findstate12_sig, "docstring" => $findstate_doc), 'tests.returnPhpObject' => $returnObj_sig);
$signatures = array_merge($signatures, $moreSignatures);
// enable support for the NULL extension
PhpXmlRpc\PhpXmlRpc::$xmlrpc_null_extension = true;
$s = new PhpXmlRpc\Server($signatures, false);
$s->setdebug(3);
$s->compress_response = true;
// out-of-band information: let the client manipulate the server operations.
// we do this to help the testsuite script: do not reproduce in production!
if (isset($_GET['RESPONSE_ENCODING'])) {
    $s->response_charset_encoding = $_GET['RESPONSE_ENCODING'];
}
if (isset($_GET['DETECT_ENCODINGS'])) {
    PhpXmlRpc\PhpXmlRpc::$xmlrpc_detectencodings = $_GET['DETECT_ENCODINGS'];
}
if (isset($_GET['EXCEPTION_HANDLING'])) {
    $s->exception_handling = $_GET['EXCEPTION_HANDLING'];
}
$s->service();
// that should do all we need!
// out-of-band information: let the client manipulate the server operations.
// we do this to help the testsuite script: do not reproduce in production!
if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) {
    include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/append.php";
}
Exemplo n.º 2
0
 public function testUtf8Method()
 {
     PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'UTF-8';
     $m = new xmlrpcmsg("tests.utf8methodname." . 'κόσμε', array(new xmlrpcval('hello')));
     $v = $this->send($m);
     if ($v) {
         $this->assertEquals('hello', $v->scalarval());
     }
     PhpXmlRpc\PhpXmlRpc::$xmlrpc_internalencoding = 'ISO-8859-1';
 }