简体   繁体   中英

Zend Framework: catch custom soap exceptions

how do I catch my custom soap fault ProductoInexistente when requesting a soap web service operation? my code is the following, but it's not working:

$_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';
}

thanks!

Is there the exception of type ProductoInexistente thrown?
Try changing the code to

$_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);
}

And see what's the name of exception class.
Unless the exception of ProductoInexistente it cannot be caught by catch(ProductoInexistente $ex)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM