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

Reply via email to