【问题标题】:xmlrpc unsupported method call with phpxmlrpc 使用 php 调用不受支持的方法
【发布时间】:2012-07-30 19:57:00
【问题描述】:

我在远程 IIS 服务器上的 somefile.ashx 上有一个方法,我尝试调用的方法之一是“UserLogInReq”。

UserLogInReq 有以下成员:

字符串:用户名
字符串:密码
字符串:客户端类型

到目前为止,这是我的脚本:

$request = xmlrpc_encode_request('UserLogInReq', array("UserName" => '$username',"Password" =>'$password',"ClientType" => ''));

$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));

$file = file_get_contents("http://someserver/somepage.ashx", false, $context);

$response = xmlrpc_decode($file);

if ($response && xmlrpc_is_fault($response)) {
  trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
  print_r($response);
}

当我导航到我的 web 服务页面时,在 somepage.ashx 中,会列出此方法以及所有这些成员。但是,当我运行此脚本时,我得到:

Notice: unsupported method called: UserLogInReq (0)

我能找到的所有帮助都与通用 xml-rpc 连接/调用无关。

这是网络服务的权限问题吗? 我做错了什么?

谢谢!

【问题讨论】:

    标签: php xmlhttprequest xml-rpc


    【解决方案1】:

    这最终成为我的一个误解。 XML-RPC requriers structs,相当于 php 中的嵌套数组。我只需要在 php 数组上降低几个级别。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-24
      • 2012-10-18
      • 1970-01-01
      • 1970-01-01
      • 2014-02-16
      • 2015-04-30
      • 1970-01-01
      • 2017-11-07
      相关资源
      最近更新 更多