1
我從一個try ... catch塊內進行SOAP調用,未捕獲的肥皂錯誤
$request->l_Request->Year = $year;
// $request->l_Request->Period = $period;
try {
/**
*
* perform getMake request
* @var stdClass
*/
$response = $client->getSeries($request);
$series = $response->getSeriesResult->Lookup_Struc;
return $series;
} catch (SoapFault $exception) {
/**
* log exception on soap request
*/
$this->getLogger()->log($exception->getMessage(), Zend_Log::ERR);
$this->getLogger()->log($exception->getTraceAsString(), Zend_Log::INFO);
return false;
} catch (Exception $exception) {
/**
* log exception on soap request
*/
$this->getLogger()->log($exception->getMessage(), Zend_Log::ERR);
$this->getLogger()->log($exception->getTraceAsString(), Zend_Log::INFO);
return false;
}
下面是我的輸出/錯誤看起來像
(!) Fatal error: SOAP-ERROR: Encoding: object has no 'Period' property in C:\wamp\www\FHH\library\Zend\Soap\Client.php on line 1121
但我無法趕上肥皂錯誤使用try catch,有沒有特殊的方法來處理這個問題。
這不是[例外](http://php.net/manual/en/language.exceptions.php),它是[錯誤](http://php.net/manual/en/book。 errorfunc.php),有一個區別。如果你想抓住它,你必須[將其轉換爲例外](http://www.google.com/search?q=php+convert+exception+to+error)。雖然它是'E_FATAL',但您可能無法爲特定情況做到這一點。 PHP本地SOAP擴展在這方面非常難以處理,這也是許多應用程序使用[NuSOAP](http://sourceforge.net/projects/nusoap/)的原因。 – DaveRandom 2012-04-18 10:46:06
確保'期限'是正確的。這可能是一個區分大小寫的問題。 – Liyali 2012-04-18 12:42:24
DaveRandom謝謝,Liyali你沒有得到的觀點我想要得到一個異常/肥皂錯誤,這就是爲什麼我評論的代碼,我的問題點並不是我爲什麼得到我應該如何處理錯誤,閱讀問題請 – 2012-04-19 00:49:45