Skip to content

Commit

Permalink
Excepciones SOAP configurables (#114)
Browse files Browse the repository at this point in the history
* Excepciones SOAP configurables

Se agrega la opción de poder indicar si el cliente SOAP debe lanzar excepciones o no. Lanzando excepciones ayuda a mejorar la gestión de mensajes de error.

Por defecto queda retrocompatible en `false` y en caso de ser aprobado y fusionado debería actualizarse la Wiki acá: https://github.com/AfipSDK/afip.php/wiki/Primeros-pasos

* Corregido acceso a opción de excepción

Dentro de `AfipWebService` se accede mediante `$this->afip->options` y no `$this->options`.
  • Loading branch information
alejandro-fiore authored Dec 10, 2021
1 parent 89d3a55 commit 957bc43
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/Afip.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function __construct($options)
$options['passphrase'] = 'xxxxx';
}

if (!isset($options['exceptions'])) {
$options['exceptions'] = FALSE;
}

if (!isset($options['cert'])) {
$options['cert'] = 'cert';
}
Expand Down Expand Up @@ -222,11 +226,11 @@ private function CreateServiceTA($service)

//Request TA to WSAA
$client = new SoapClient($this->WSAA_WSDL, array(
'soap_version' => SOAP_1_2,
'location' => $this->WSAA_URL,
'trace' => 1,
'exceptions' => 0,
'stream_context' => stream_context_create(['ssl'=> ['ciphers'=> 'AES256-SHA','verify_peer'=> false,'verify_peer_name'=> false]])
'soap_version' => SOAP_1_2,
'location' => $this->WSAA_URL,
'trace' => 1,
'exceptions' => $this->options['exceptions'],
'stream_context' => stream_context_create(['ssl'=> ['ciphers'=> 'AES256-SHA','verify_peer'=> false,'verify_peer_name'=> false]])
));
$results=$client->loginCms(array('in0'=>$CMS));
if (is_soap_fault($results))
Expand Down Expand Up @@ -451,12 +455,12 @@ public function ExecuteRequest($operation, $params = array())
{
if (!isset($this->soap_client)) {
$this->soap_client = new SoapClient($this->WSDL, array(
'soap_version' => $this->soap_version,
'location' => $this->URL,
'trace' => 1,
'exceptions' => 0,
'soap_version' => $this->soap_version,
'location' => $this->URL,
'trace' => 1,
'exceptions' => $this->afip->options['exceptions'],
'stream_context' => stream_context_create(['ssl'=> ['ciphers'=> 'AES256-SHA','verify_peer'=> false,'verify_peer_name'=> false]])
));
));
}

$results = $this->soap_client->{$operation}($params);
Expand Down

0 comments on commit 957bc43

Please sign in to comment.