";对象引用未设置为对象的实例“;从PHP调用SOAP服务时出错


"Object reference not set to an instance of an object" error calling SOAP service from PHP

我正试图使用以下代码从PHP通过SOAP访问此web服务:

ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$wsdl_path = "http://www.neugroup.com/workarea/servercontrolws.asmx?WSDL";
$username = 'username';
$password = 'password';
$client = new SoapClient($wsdl_path, array(
  "trace"      => 1,
  "exceptions" => 0)
);
try {
  $result = $client->LoadListSummary(array(
    'LangID' => 1033,
    'FolderPath' => 'path/',
    'MaxResults' => 500,
    'OrderKey' => 'Title',
    'Direction' => 'Ascending',
    'Preview' => 0,
    'Recursive' => 0,
    'RetrieveSummary' => 0,
    'Random' => 0,
    'GetHtml' => 0,
    'ContentType' => 'AllTypes',
    )
  );
}
catch (SoapFault $exception) {
  echo $exception;
}

但我得到了一个"对象引用未设置为对象实例"的错误。我正在逐步了解这是一个调试器,我可以看到$client是一个对象。是不是我做错了什么导致了这个错误?另外,我的SOAP调用结构是否正确?

谢谢。

看起来你没有做错什么,错误在服务中,所以可能会出现以下两种情况之一:

  1. 您的一个参数错误,导致服务解析为空对象(路径可能是候选路径),而服务器没有对此进行验证,并尝试对对象执行操作
  2. 您呼叫的服务出现一般故障