我正在尝试通过带有CURL的Internet Explorer访问Web服务(在本地工作正常),但是我收到了以下错误消息:
System.InvalidOperationException:缺少参数:server。在System.Web.Services.Protue上的System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection集合),System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
中的System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()这是我的电话:
$aParamWS["serverName"] = $paramArray["serverName"];
$aParamWS["userName"] = $paramArray["userName"];
$sUrl_ws = "http://myServer/WS_TEST/test_webService.asmx/TestMethod";
$curl = curl_init($sUrl_ws);
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_VERBOSE, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
//curl_setopt($curl, CURLOPT_USERAGENT, "PhpRestClient");
curl_setopt($curl, CURLOPT_POST, true);
foreach($aParamWS as $key=>$value)
{
$post_array_string .=$key.'='.$value.'&';
}
$post_array_string = rtrim($post_array_string, '&');
curl_setopt($curl, CURLOPT_POST, count($aParamWS));
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_array_string);
$curl_response = curl_exec($curl);
curl_close($curl);
echo $curl_response;
我知道这个问题已经通过stringify数组解决了很多次,但它仍然无效。 任何的想法 ? 非常感谢
答案 0 :(得分:0)
$aParamWS["serverName"] = $paramArray["serverName"];
我注意到你的参数中有“serverName”但不是“server”。你的意思是“服务器”作为参数吗?