0
如何在請求soap web服務操作時捕獲自定義soap故障ProductoInexistente?我的代碼如下,但它不工作:Zend Framework:捕獲自定義肥皂異常
$_WSDL_URI = 'http://joaquinlrobles.redirectme.net:8080/Pelopincho/PelopinchoService?WSDL';
$ws = new Zend_Soap_Client($_WSDL_URI, array('soap_version' => SOAP_1_1));
try {
$resultado = $ws->getStockProducto(array('idProducto' => $idProducto));
$this->view->resultado = $resultado->result;
}
catch (ProductoInexistente $ex) {
$this->view->resultado = 'Producto Inexistente';
}
謝謝!
抓住良好,轉儲我可以看到,該捕獲到的異常是ProductoInexistente例外: 對象(的SOAPFault)#53(9){[「消息:保護「] =>字符串(25)」comun.ProductoInexistente「... – 2010-02-02 14:17:56
實際上它不是。異常的對象似乎是SoapFault。因此,如果您嘗試{...} catch(SoapFault $ ex){...},您應該捕獲異常。 – 2010-02-02 16:03:28
是的,我應該捕獲操作引發的所有自定義異常...在C#中,您應該捕獲System.Services.SoapFault,它都可以......我應該在這裏處理每個自定義異常單獨拋出? –
2010-02-03 14:28:31