2010-02-02 4 views
0

비누 웹 서비스 작업을 요청할 때 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 (ProductoInexistente $ex) { 
$this->view->resultado = 'Producto Inexistente'; 
} 

감사합니다!

답변

0

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

에 코드를 변경 시도하고 예외 클래스의 이름이 무엇을 참조하십시오. 오브젝트 (SOAPFault의) # 53 (9) {[ "메시지 :
ProductoInexistente의 예외가 덤프로 잘

+0

catch(ProductoInexistente $ex) 의해 잡힐 수 않는 I 예외를 잡은 것을 볼 수는 ProductoInexistente 예외이다 보호 "] => string (25)"comun.ProductoInexistente "... –

+0

사실 그것은 그렇지 않습니다. 예외의 개체는 SoapFault 인 것 같습니다. 따라서 {...} catch (SoapFault $ ex) {...}를 시도하면 예외를 catch해야합니다. –

+0

예, 나는 모든 예외를 캐치해야한다. C#에서는 System.Services.SoapFault 를 잡아야한다. 그리고 그것은 모두 OK이다. 그리고 별도로 던져지는 모든 커스텀 예외를 처리하기 위해 여기서 무엇을해야 하는가? –