我在somefile.ashx的远程IIS服务器上有一个方法,我试图调用的方法之一是"UserLogInReq"。
UserLogInReq具有以下成员:
字符串:用户名
字符串:密码
字符串:ClientType
到目前为止,这是我的脚本:
$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连接/调用无关。
这是web服务的权限问题吗?我做错了什么?
谢谢!
这最终成为了我的误解。XML-RPC请求结构,相当于php中的嵌套数组。我只需要深入了解php数组的几个级别。