| 1 |
lars |
1 |
--TEST--
|
|
|
2 |
PHP Backend XML-RPC server with non-existant method response
|
|
|
3 |
--FILE--
|
|
|
4 |
<?php
|
|
|
5 |
class EchoServer {
|
|
|
6 |
/**
|
|
|
7 |
* echoecho echoes the message received
|
|
|
8 |
*
|
|
|
9 |
* @param string Message
|
|
|
10 |
* @return string The echo
|
|
|
11 |
*/
|
|
|
12 |
public static function echoecho($string) {
|
|
|
13 |
return $string;
|
|
|
14 |
}
|
|
|
15 |
}
|
|
|
16 |
|
|
|
17 |
set_include_path(realpath(dirname(__FILE__) . '/../../../../') . PATH_SEPARATOR . get_include_path());
|
|
|
18 |
require_once 'XML/RPC2/Backend.php';
|
|
|
19 |
require_once 'XML/RPC2/Server.php';
|
|
|
20 |
require_once 'XML/RPC2/Backend/Php/Response.php';
|
|
|
21 |
XML_RPC2_Backend::setBackend('php');
|
|
|
22 |
$server = XML_RPC2_Server::create('EchoServer');
|
|
|
23 |
$GLOBALS['HTTP_RAW_POST_DATA'] = <<<EOS
|
|
|
24 |
<?xml version="1.0"?>
|
|
|
25 |
<methodCall>
|
|
|
26 |
<methodName>example</methodName>
|
|
|
27 |
<params><param><value><string>World</string></value></param></params>
|
|
|
28 |
</methodCall>
|
|
|
29 |
EOS
|
|
|
30 |
;
|
|
|
31 |
$response = $server->getResponse();
|
|
|
32 |
try {
|
|
|
33 |
XML_RPC2_Backend_Php_Response::decode(simplexml_load_string($response));
|
|
|
34 |
} catch (XML_RPC2_FaultException $e) {
|
|
|
35 |
var_dump($e->getFaultCode());
|
|
|
36 |
var_dump($e->getMessage());
|
|
|
37 |
}
|
|
|
38 |
?>
|
|
|
39 |
--EXPECT--
|
|
|
40 |
int(-32601)
|
|
|
41 |
string(40) "server error. requested method not found"
|