2011-12-01 57 views
0

我正在使用PHP SOAP將數據發送到Web服務。PHP SOAP - 處理Web服務失敗和超時

一切工作正常,但我在努力尋找的問候什麼處理Web服務中斷,響應時間慢等

Web服務是不是我的,所以我不得不模擬無通過使用不正確的位置設置來響應。因爲它站立了致命的錯誤被拋出。

數據在SOAP調用之前存儲,所以理想情況下我想嘗試幾次,如果沒有響應存儲此結果並將用戶移動到其上,

下面是代碼爲參考依據:

$soap = new SoapClient(null , array( 

    "location" => "https://www.thewebservice.com", 
    "uri" => "http://www.w3.org/2001/XMLSchema-instance", 
    "trace"=>true 

    )); 

    $ret = $soap->__soapCall("executeSoap" , Array($xmlvar)); 
+0

看一看這個http://stackoverflow.com/questions/3500527/php-soapclient-timeout – davykiash

回答

0
try { 
//your soap code 
} catch (SoapFault $e) { 
//error handling 
}