Joaquín L. Robles
Joaquín L. Robles

Reputation: 6494

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!

Upvotes: 0

Views: 2084

Answers (1)

mike
mike

Reputation: 5213

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)

Upvotes: 1

Related Questions