SOAP and Exception Handling

From: Date: Sat, 02 May 2009 04:58:53 +0000
Subject: SOAP and Exception Handling
Groups: php.general 
Request: Send a blank email to php-general+get-292206@lists.php.net to get a copy of this message
Hello Guys, I use SOAP calls to make web service requests.I have a class that does webservice calls to various wsdls. So my question is about try catch blocks. so my method looks like this: private function method($cookie){ //Define Client try{ // Check if WSDL exists if(!@file_get_contents($this->WSDL)) { throw new SoapFault('Server', 'No WSDL found at ' . $this->WSDL); } $client = new SoapClient($this->WSDL, array( 'exceptions' => 1, 'encoding' => "UTF-8", 'connection_timeout' => 60 )); }catch(SoapFault $fault){ // Error if the WSDL is not available or new client cannot be made //log errror } //Define Input Array $input = array(); $input['cookie'] = $cookie; //Make the call try{ $result = $client->function($input);// Make the Call return $result; }catch(SoapFault $fault){ //log error } } How is it possible for me to *remove *these 2 try and catch blocks from this method and just throw exceptions, but do a try and catch in the business logic. So basically I might have different functions in business logic area that might call the same method and I do error logging there itself instead directly in the method? Thanks, V

« previous php.general (#292206) next »