我正在使用php soap调用一个方法。
$options = ['trace' => 1,
'exceptions' => true,
'wsdl_cache' => WSDL_CACHE_NONE];
$wsdl = 'confidential-wsdl';
$client = new \SoapClient($wsdl,$options);
try {
$result = $client->__call("SomeClientsMethod",array($params));
$response = $client->__getLastResponse();
var_dump($result); // Not all data received
var_dump($response); // All data received
} catch (\Exception $e) {
//No exception thrown
throw new \Exception("Request failed!".$client->__getLastResponse());
}
此调用不会返回wsdl中定义的所有数据,但如果我调用$ client - > __ getLastResponse(),那么我将正确接收所有数据
有人能把我放在正确的调试方向吗?提前致谢
调用方法和wsdl使用我没有收到的其他数据进行更新。
要捕获错误,请尝试将您的调用包装在try/catch中:
try{
$client = new \SoapClient($wsdl,$options);
$client->__call("SomeClientsMethod",array($params));
}
# I'm not sure exactly which one of these it is:
catch(Throwable $e){
var_dump($e->getMessage());
}
catch (SoapFault $e) {
var_dump($e->getMessage());
}
看起来这是一个缓存问题。可能是因为php.ini中的soap.wsdl_cache_ttl = 86400选项现在,调用函数会返回所有数据...
谢谢你的回答