public function __Construct($ws,$empresaAlias) { if (!$this->validWs($ws)) criticalExit("AfipWsaa::__Construct() - Se debe especificar un WebService ".($ws?" valido. (Ref.: ".$ws.") ":"")." como parametro del constructor."); if (!$empresaAlias) criticalExit("AfipWsaa::__Construct() - Se debe especificar un alias de empresa como parametro del constructor."); $entorno = SERVER_ENTORNO; //criticalExit($entorno); $this->ws = $ws; if ($entorno == 'Test') $this->ea = $empresaAlias; elseif ($entorno == 'Prod') //$this->ea = $empresaAlias."hp"; $this->ea = $empresaAlias; $this->wsFilePath = dirname(__FILE__).'/wsfiles/'; $this->traXmlFile = TMP_PATH.$this->ea.'_'.$this->ws.'_tra.xml'; $this->traTmpFile = TMP_PATH.$this->ea.'_'.$this->ws.'_tra.tmp'; $this->taFile = TMP_PATH.$this->ea.'_'.$this->ws.'_ta.xml'; //$this->wsdl = $this->wsFilePath."wsaa.wsdl"; $this->wsdl = "/home6/pymebit/public_html/api/clases_funciones/factura_electronica/wsfiles/wsaa.wsdl"; if ($entorno == 'Test') { $this->cert = $this->wsFilePath.$this->ea."_test.crt"; $this->url = "https://wsaahomo.afip.gov.ar/ws/services/LoginCms"; $this->privateKey = $this->wsFilePath.$this->ea."_test.key"; } elseif ($entorno == 'Prod') { $this->cert = $this->wsFilePath.$this->ea."_prod.crt"; $this->url = "https://wsaa.afip.gov.ar/ws/services/LoginCms"; $this->privateKey = $this->wsFilePath.$this->ea."_prod.key"; } else { criticalExit('AfipWsaa::__Construct() - No se ha definido la constante: SERVER_ENTORNO'); } /* // ******************* // Imprime las rutas de los archivos para verificar echo "Certificado: " . $this->cert . "\n"; echo "Clave privada: " . $this->privateKey . "\n"; // ****************** */ if (!file_exists($this->cert)) criticalExit("AfipWsaa::__Construct() - No se pudo abrir el archivo ".$this->cert); if (!file_exists($this->privateKey)) criticalExit("AfipWsaa::__Construct() - No se pudo abrir el archivo ".$this->privateKey); if (!file_exists($this->wsdl)) criticalExit("AfipWsaa::__Construct() - No se pudo abrir el archivo ".$this->wsdl); $this->errLog = new ErrorLog(); }