Пример #1
0
 public function testReconnect()
 {
     $start = microtime(true);
     $client = new Client(null, array('uri' => '', 'location' => ''));
     $client->setConnectTimeout(1000);
     $client->setConnectAttempts(3);
     try {
         $client->__soapCall('', array(), array('location' => '10.255.255.1', 'uri' => ''));
     } catch (ClientException $e) {
     }
     $this->assertGreaterThanOrEqual(3, round(microtime(true) - $start));
 }
Пример #2
0
 public function getSoapClient()
 {
     if ($this->soap_client) {
         return $this->soap_client;
     }
     try {
         $soap_client = new InteleonSoapClient('https://europe.ipx.com/api/services2/SmsApi52?wsdl', array('exceptions' => true, 'trace' => false, 'cache_wsdl' => $this->cache_wsdl, 'connect_timeout' => $this->connect_timeout / 1000));
         $soap_client->setTimeout($this->timeout);
         $soap_client->setConnectTimeout($this->connect_timeout);
         $soap_client->setConnectAttempts($this->connect_attempts);
         $soap_client->setVerifyCertificate($this->verify_certificate);
         return $this->soap_client = $soap_client;
     } catch (SoapFault $sf) {
         $soap_fault_text = "Cannot create SOAP-client" . PHP_EOL . "SOAP-faultcode: " . $sf->faultcode . PHP_EOL . 'SOAP-faultstring: ' . $sf->faultstring;
         throw new Exception($soap_fault_text);
     } catch (InteleonSoapClientException $e) {
         throw new Exception('Connection error: ' . $e->getMessage());
     }
 }
Пример #3
0
 /**
  * Get the Soap client
  *
  * @return SoapClient
  */
 public function getSoapClient()
 {
     if (isset($this->soap_client)) {
         return $this->soap_client;
     }
     try {
         $soap_client = new InteleonSoapClient($this->wsdl, array('exceptions' => true, 'trace' => false, 'cache_wsdl' => $this->cache_wsdl, 'features' => SOAP_SINGLE_ELEMENT_ARRAYS, 'connect_timeout' => $this->connect_timeout / 1000));
         $soap_client->setTimeout($this->timeout);
         $soap_client->setConnectTimeout($this->connect_timeout);
         $soap_client->setConnectAttempts($this->connect_attempts);
         $soap_client->setVerifyCertificate($this->verify_certificate);
         //Set headers
         $soap_header_data = new SoapVar('<wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><wsse:UsernameToken wsu:Id="UsernameToken-3" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><wsse:Username>' . $this->username . '</wsse:Username><wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">' . $this->password . '</wsse:Password></wsse:UsernameToken></wsse:Security>', XSD_ANYXML);
         $soap_header = new SoapHeader('http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd', 'Security', $soap_header_data);
         $soap_client->__setSoapHeaders($soap_header);
         return $this->soap_client = $soap_client;
     } catch (SoapFault $sf) {
         throw new ClientException($this->soapFaultToString($sf));
     } catch (InteleonSoapClientException $e) {
         throw new ClientException('Connection error: ' . $e->getMessage());
     }
 }
Пример #4
0
 /**
  * Get the Soap Client. Instantiate new one if not already set.
  *
  * @return SoapClient
  */
 protected function getSoapClient()
 {
     //Already instantiated
     if (isset($this->soap_client)) {
         return $this->soap_client;
     }
     try {
         $soap_client = new InteleonSoapClient('https://securews.decidas.com/DecidasService.asmx?WSDL', array('authentication' => SOAP_AUTHENTICATION_BASIC, 'login' => $this->username, 'password' => $this->password, 'exceptions' => true, 'trace' => false, 'cache_wsdl' => $this->cache_wsdl, 'connect_timeout' => $this->connect_timeout / 1000));
         $soap_client->setTimeout($this->timeout);
         $soap_client->setConnectTimeout($this->connect_timeout);
         $soap_client->setConnectAttempts($this->connect_attempts);
         $soap_client->setVerifyCertificate($this->verify_certificate);
     } catch (SoapFault $sf) {
         $error_string = '[' . $sf->faultcode . '] ' . $sf->faultstring;
         if (isset($sf->faultdetail) && $sf->faultdetail) {
             $error_string .= ' (' . $sf->faultdetail . ')';
         }
         throw new ClientException($error_string);
     } catch (InteleonSoapClientException $e) {
         throw new ClientException('Connection error (' . $e->getMessage() . ')');
     }
     return $this->soap_client = $soap_client;
 }