簡體   English   中英

Zend Framework:捕獲自定義的肥皂異常

[英]Zend Framework: catch custom soap exceptions

請求肥皂Web服務操作時如何捕獲我的自定義肥皂故障ProductoInexistentente? 我的代碼如下,但是不起作用:

$_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
嘗試將代碼更改為

$_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 (Exception $ex) {
 var_dump($ex);
}

並查看異常類的名稱是什么。
除非ProductoInexistente例外,否則不能被catch(ProductoInexistente $ex)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM