Example #1
0
 /**
  * Get Web Response of Jamef WebService
  */
 public function getResponseWs($cep)
 {
     $url = $this->getUrlWebservice();
     if (!$url) {
         $this->_msgErro = 'Bad Web Service URL';
         $retorno = NULL;
     }
     $info = $this->getInformations();
     try {
         $parameters = new stdClass();
         $parameters->TIPTRA = $this->getConfigData('tiptra');
         $parameters->CNPJCPF = $this->getConfigData('cnpj');
         $parameters->MUNORI = $this->getConfigData('munori');
         $parameters->ESTORI = $this->getConfigData('estori');
         $parameters->SEGPROD = $this->getConfigData('segprod');
         $parameters->QTDVOL = 1;
         $parameters->VALMER = number_format($this->geraValor(), 2, '.', '');
         $parameters->PESO = number_format($info['weight'], 2, '.', '');
         $parameters->METRO3 = number_format($info['cubagem'], 2, '.', '');
         $parameters->FILCOT = $this->getConfigData('filcot');
         $parameters->CNPJDES = $this->getConfigData('cnpj');
         $parameters->CEPDES = str_replace('-', '', $cep);
         if ($this->getConfigFlag('debug')) {
             $this->getHelper()->writeLog($parameters);
         }
         $ws = new SoapClient($url, array('trace' => 1, 'exceptions' => 1, 'connection_timeout' => $this->getConfigData('timeout') ? $this->getConfigData('timeout') : 30, 'style' => SOAP_DOCUMENT, 'use' => SOAP_LITERAL, 'soap_version' => SOAP_1_1, 'encoding' => 'UTF-8'));
         $retorno = $ws->JAMW0520_03($parameters);
         if ($this->getConfigFlag('debug')) {
             $this->getHelper()->writeLog($retorno);
         }
     } catch (SoapFault $fault) {
         $retorno = NULL;
         Mage::logException($fault);
     }
     return $retorno;
 }