Example #1
0
 /**
  * Send SOAP event
  *
  * @param string $evenement_name Event name
  * @param bool   $flatten        Flat args
  *
  * @return bool|void
  * @throws CMbException
  */
 function send($evenement_name = null, $flatten = false)
 {
     if (!$this->_id) {
         throw new CMbException("CSourceSOAP-no-source", $this->name);
     }
     if (!$evenement_name) {
         $evenement_name = $this->evenement_name;
     }
     if (!$evenement_name) {
         throw new CMbException("CSourceSOAP-no-evenement", $this->name);
     }
     if ($this->single_parameter) {
         $this->_data = array("{$this->single_parameter}" => $this->_data);
     }
     if (!$this->_data) {
         $this->_data = array();
     }
     $options = array("encoding" => $this->encoding, "return_mode" => "normal");
     if ($this->return_mode) {
         $options["return_mode"] = $this->return_mode;
     }
     if ($this->soap_version) {
         $options["soap_version"] = constant($this->soap_version);
     }
     if ($this->xop_mode) {
         $options["xop_mode"] = true;
     }
     if ($this->use_tunnel) {
         $options["use_tunnel"] = true;
     }
     if ($this->feature) {
         $options["features"] = constant($this->feature);
     }
     $soap_client = new CSOAPClient($this->type_soap);
     $this->_soap_client = $soap_client;
     $password = $this->getPassword();
     $passphrase = $this->getPassword($this->passphrase, "iv_passphrase");
     $soap_client->make($this->host, $this->user, $password, $this->type_echange, $options, null, $this->stream_context, $this->local_cert, $passphrase, $this->safe_mode, $this->verify_peer, $this->cafile, $this->wsdl_external, $this->socket_timeout, $this->connection_timeout);
     if ($soap_client->client->soap_client_error) {
         throw new CMbException("CSourceSOAP-unreachable-source", $this->name);
     }
     // Applatissement du tableau $arguments qui contient un élément vide array([0] => ...) ?
     $soap_client->client->flatten = $flatten;
     // Définit un ent-ête à utiliser dans les requêtes ?
     if ($this->_headerbody) {
         $soap_client->setHeaders($this->_headerbody);
     }
     // Aucun log à produire ?
     $soap_client->client->loggable = $this->loggable;
     $this->_acquittement = $soap_client->call($evenement_name, $this->_data);
     if (is_object($this->_acquittement)) {
         $acquittement = (array) $this->_acquittement;
         if (count($acquittement) == 1) {
             $this->_acquittement = reset($acquittement);
         }
     }
     return true;
 }