Esempio n. 1
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());
     }
 }