Welcome Guest, Not a member yet? Register   Sign In
Problem on Exception of the CodeIgniter
#1

[eluser]rodrigoprazim[/eluser]
Hello,

I'm having a problem in executing of a function.

Code:
public function search($id=''){
        if($id!=''){
            try{
                $function = 'search';
                $dados = array('id'=>$id);
                $client = new soapclient($this->link().?wsdl');
           $err = $client->__soapCall($function,$dados,$options);
           return $err;
       }catch (Exception $e){
          return FALSE;
      }
   }
}

Even using a try and catch, but codeginiter shows an error when the link in Soap function is unavailable.

Help me, I don't want to show the error.
#2

[eluser]InsiteFX[/eluser]
CodeIgniter uses it's own exceptions class.
#3

[eluser]rodrigoprazim[/eluser]
I know, but as I ignore the exception class CI just for that function?
#4

[eluser]CroNiX[/eluser]
Why don't you just use class_exists('soapclient') and test to see if soap client available before trying to use it
#5

[eluser]rodrigoprazim[/eluser]
The soapclient class will always exist, but the link will not always be available.

Code:
function link(){
    return "http://192.168.0.1:8080/ClientService";
}

public function search($id=''){
        if($id!=''){
            try{
                $function = 'search';
                $dados = array('id'=>$id);
                $client = new soapclient($this->link().?wsdl');
           $err = $client->__soapCall($function,$dados,$options);
           return $err;
       }catch (Exception $e){
          return FALSE;
      }
   }
}
#6

[eluser]CroNiX[/eluser]
You can also check if the url exists and returns a 200 status code before attempting the soap call.




Theme © iAndrew 2016 - Forum software by © MyBB