diff --git a/src/Common/Soap/SoapBase.php b/src/Common/Soap/SoapBase.php index 83d916f..975bb83 100755 --- a/src/Common/Soap/SoapBase.php +++ b/src/Common/Soap/SoapBase.php @@ -33,7 +33,7 @@ abstract class SoapBase implements SoapInterface /** * @var int */ - protected $soaptimeout = 20; + protected $soaptimeout = 60; /** * @var string */ @@ -138,6 +138,10 @@ abstract class SoapBase implements SoapInterface * @var string */ public $soaperror; + /** + * @var string + */ + public $soaperrorno; /** * @var array */ @@ -160,7 +164,7 @@ public function __construct( $this->certificate = $this->checkCertValidity($certificate); $this->setTemporaryFolder(sys_get_temp_dir() . '/sped/'); } - + /** * Check if certificate is valid * @param Certificate $certificate @@ -181,7 +185,7 @@ private function checkCertValidity(Certificate $certificate = null) } return $certificate; } - + /** * Destructor * Clean temporary files @@ -190,7 +194,7 @@ public function __destruct() { $this->removeTemporarilyFiles(); } - + /** * Disables the security checking of host and peer certificates * @param bool $flag @@ -200,7 +204,7 @@ public function disableSecurity($flag = false) $this->disablesec = $flag; return $this->disablesec; } - + /** * ONlY for tests * @param bool $flag @@ -222,7 +226,7 @@ public function loadCA($capath) $this->casefaz = $capath; } } - + /** * Set option to encript private key before save in filesystem * for an additional layer of protection @@ -233,7 +237,7 @@ public function setEncriptPrivateKey($encript = true) { return $this->encriptPrivateKey = $encript; } - + /** * Set another temporayfolder for saving certificates for SOAP utilization * @param string $folderRealPath @@ -243,7 +247,7 @@ public function setTemporaryFolder($folderRealPath) $this->tempdir = $folderRealPath; $this->setLocalFolder($folderRealPath); } - + /** * Set Local folder for flysystem * @param string $folder @@ -263,7 +267,7 @@ public function setDebugMode($value = false) { return $this->debugmode = $value; } - + /** * Set certificate class for SSL comunications * @param Certificate $certificate @@ -272,7 +276,7 @@ public function loadCertificate(Certificate $certificate) { $this->certificate = $this->checkCertValidity($certificate); } - + /** * Set logger class * @param LoggerInterface $logger @@ -281,7 +285,7 @@ public function loadLogger(LoggerInterface $logger) { return $this->logger = $logger; } - + /** * Set timeout for communication * @param int $timesecs @@ -290,7 +294,7 @@ public function timeout($timesecs) { return $this->soaptimeout = $timesecs; } - + /** * Set security protocol * @param int $protocol @@ -300,7 +304,7 @@ public function protocol($protocol = self::SSL_DEFAULT) { return $this->soapprotocol = $protocol; } - + /** * Set prefixes * @param array $prefixes @@ -310,7 +314,7 @@ public function setSoapPrefix($prefixes) { return $this->prefixes = $prefixes; } - + /** * Set proxy parameters * @param string $ip @@ -325,7 +329,7 @@ public function proxy($ip, $port, $user, $password) $this->proxyUser = $user; $this->proxyPass = $password; } - + /** * Send message to webservice */ @@ -336,7 +340,7 @@ abstract public function send( $envelope, $parameters ); - + /** * Mount soap envelope * @param string $request @@ -372,7 +376,7 @@ protected function makeEnvelopeSoap( . ""; return $envelope; } - + /** * Temporarily saves the certificate keys for use cURL or SoapClient */ @@ -419,7 +423,7 @@ public function saveTemporarilyKeyFiles() ); } } - + /** * Delete all files in folder */ @@ -457,7 +461,7 @@ public function removeTemporarilyFiles() } } } - + /** * Save request envelope and response for debug reasons * @param string $operation diff --git a/src/Common/Soap/SoapCurl.php b/src/Common/Soap/SoapCurl.php index 91e84fb..6947d44 100755 --- a/src/Common/Soap/SoapCurl.php +++ b/src/Common/Soap/SoapCurl.php @@ -85,6 +85,7 @@ public function send( } $response = curl_exec($oCurl); $this->soaperror = curl_error($oCurl); + $this->soaperrorno = (string) curl_errno($oCurl); $ainfo = curl_getinfo($oCurl); if (is_array($ainfo)) { $this->soapinfo = $ainfo; @@ -100,10 +101,12 @@ public function send( $this->responseHead . "\n" . $this->responseBody ); } catch (\Exception $e) { - throw SoapException::unableToLoadCurl($e->getMessage()); + throw new SoapException('LIBCURL não localizada', 500); + //::unableToLoadCurl($e->getMessage(), 500); } if ($this->soaperror != '') { - throw SoapException::soapFault($this->soaperror . " [$url]", $this->soaperror); + throw new SoapException($this->soaperror . " [$url]", $this->soaperrorno); + //::soapFault($this->soaperror . " [$url]", $this->soaperror); } if ($httpcode != 200) { throw SoapException::soapFault(