我很难发现 SoapClient 身份验证问题。当我的代码执行时,Laravel 声明它正在抛出一个 ErrorException 但无论我使用什么代码,我似乎都无法捕捉到它。我正在标记 Laravel,以防在我不知道的地方发生了一些魔法,因为 App::error() 仍然会触发这个错误。
try {
$client = new SoapClient(
$this->serviceUrl . $this->clients[$clientName],
array(
'login' => $this->username,
'password' => $this->password,
'exceptions' => true,
)
);
} catch (SoapFault $e) {
die('soapfault never fires!');
} catch (Exception $e) {
die('exception won\t t');
} catch (ErrorException $e) {
die('error exception also doesn\'t error');
}
根据 Laravel,一个 ErrorException 被抛出,但上面的代码没有捕捉到它。
ErrorException
SoapClient::SoapClient(https://control.akamai.com/nmrws/services/RealtimeReports?wsdl) [<a href='soapclient.soapclient'>soapclient.soapclient</a>]: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized