Zendに問題が発生したため、エラーが発生します。私はZendがURLに対していくつかの検証を行うので、ホスト名の下線が原因であると考えています。Zend_XmlRpc_Clientはホスト名にアンダースコアを付けます
私は、同じ基本機能を実行するPythonクライアントを持っており、期待通りに動作します。
Fatal error: Uncaught exception 'Zend_Uri_Exception' with message 'Invalid URI supplied' in /usr/share/php/libzend-framework-php/Zend/Uri/Http.php:156
Stack trace:
#0 /usr/share/php/libzend-framework-php/Zend/Uri.php(143): Zend_Uri_Http->__construct('http', '//local_server_f...')
#1 /usr/share/php/libzend-framework-php/Zend/Http/Client.php(270): Zend_Uri::factory('http://local_ser...')
#2 /usr/share/php/libzend-framework-php/Zend/XmlRpc/Client.php(266): Zend_Http_Client->setUri('http://local_ser...')
#3 /usr/share/php/libzend-framework-php/Zend/XmlRpc/Client.php(361): Zend_XmlRpc_Client->doRequest(Object(Zend_XmlRpc_Request))
#4 /usr/share/php/libzend-framework-php/Zend/XmlRpc/Client/ServerProxy.php(93): Zend_XmlRpc_Client->call('system.multical...', Array)
#5 [internal function]: Zend_XmlRpc_Client_ServerProxy->__call('multicall', Array)
#6 /path/to/xmlrpc.client.php(21): Zend_XmlRpc_Client_ServerProxy->multicall(Array)
#7 {main}
thrown in /usr/share/php/libzend-framework-php/Zend/Uri/Http.php on line 156
PHP:
ini_set("include_path", "/usr/share/php/libzend-framework-php");
require_once('Zend/XmlRpc/Client.php');
$server = new Zend_XmlRpc_Client('http://local_server_foo/xmlrpc.server.php');
// Get the HTTP Client used by the XMLRPC client and Increase the HTTP timeout
$server->getHttpClient()->setConfig(array('timeout'=>30));
$client = $server->getProxy();
$request = array(
array(
'methodName' => 'system.listMethods',
'params' => array()
)
);
try {
$response = $client->system->multicall($request);
echo print_r($response,true);
} catch (Zend_XmlRpc_Client_HttpException $e) {
echo 'HTTP Exception: '."\n";
echo $e->getCode();
echo $e->getMessage();
} catch (Zend_XmlRpc_Client_FaultException $e) {
echo 'Fault Exception: '."\n";
echo $e->getCode();
echo $e->getMessage();
}
パイソン(この作品):
#!/usr/bin/python
import xmlrpclib
servAddr = "http://local_server_foo/xmlrpc.server.php"
client = xmlrpclib.ServerProxy(servAddr)
print
methods = client.system.listMethods()
for m in methods:
print m + "\tHelp Documentation: " + client.system.methodHelp(m)
print
そこに議論がなく、なぜ私はまだ問題を提起していません。私が見る唯一のポイントは、バリデータが上記の広範なバリデーションを持っていて、最後に "ローカルネットワーク名スキーマに対する入力をチェックする;最後に検証を渡すチャンス"というラベルのついた最後の正規表現です。なぜなら、ローカルネーミングスキーマのアンダースコアを追加しないのはなぜですか? –
ローカルホスト名は、RFCによれば、下線を持つことはできません。ビジネス要件に応じてビジネス要件がある場合は、それを受け入れるカスタムバリデータを作成します。正規表現のgrokkingスキルは常に最高のわけではありませんが、 '最後のチャンス'のバリデータは、 'test.local'や 'mydevdomain'など有効なホスト名であるがtldではないドメインを確認することです。 –
ありがとうございました。検証に特殊文字を許可する方法はありますか?多分オーバーライド機能? –