37 define(
'DEBUG',
false);
42 require_once
'WSSSoapClient.php';
46 require_once (
'WSCMIME/WSCMime.php');
80 const KEYCLIENTE_AUTENTICA =
'autentica';
81 const KEYCLIENTE_AUTORIZA =
'autoriza';
82 const KEYCLIENTE_FIRMA =
'firma';
83 const KEYCLIENTE_GDE =
'gde';
84 const KEYCLIENTE_SALT =
'salt';
85 const KEYCLIENTE_CSV =
'csv';
86 const KEYCLIENTE_CATASTRO =
'catastro';
87 const KEYCLIENTE_CATASTRO_BIENES =
'catbienes';
88 const KEYCLIENTE_GDE2 =
'gde2';
89 const KEYCLIENTE_PF =
'pfcons';
90 const KEYCLIENTE_PF_MOD =
'pfmod';
91 const KEYCLIENTE_PF_ADM =
'pfadm';
92 const KEYCLIENTE_GVLOGIN =
'gvlogin';
93 const KEYCLIENTE_REGDEPARTAMENTAL =
'regdepartamental';
94 const KEYCLIENTE_DGT_CONDUCTORVEHICULOS =
'dgt_conductorvehiculos';
95 const KEYCLIENTE_DGT_DATOSVEHICULO =
'dgt_datosvehiculo';
101 const TIPOBUSQUEDA_USUARIO =
'USUARIO';
102 const TIPOBUSQUEDA_GRUPO =
'GRUPO';
111 protected static $MYSOAPOP_TRACE =
true;
112 protected static $MYSOAPOP_WSDL_CACHE = WSDL_CACHE_BOTH;
113 protected static $MYSOAPOP_SOAP_VERSION = SOAP_1_1;
120 protected static $NAMESPACE_GVA =
'http://dgm.gva.es/ayf/war/schemas/v2_00';
121 protected static $NAMESPACE_GDE =
'urn:es:gva:dgm:tra:gde:vista:model';
122 protected static $NAMESPACE_SALT =
'http://salt.ws.edu.gva.es/';
123 protected static $NAMESPACE_CSVGVA =
'urn:es:gva:dgm:tra:csvgva';
124 protected static $NAMESPACE_GDE2 =
'urn:es:gva:dgm:tra:gde:vista:v2:model';
125 protected static $NAMESPACE_CAT_ESP =
'http://intermediacion.redsara.es/scsp/esquemas/datosespecificos';
126 protected static $NAMESPACE_CAT_PET =
'http://intermediacion.redsara.es/scsp/esquemas/V3/peticion';
127 protected static $NAMESPACE_CAT_SR =
'http://intermediacion.redsara.es/scsp/esquemas/V3/solicitudRespuesta';
128 protected static $NAMESPACE_PF = null;
129 protected static $NAMESPACE_PF_MOD = null;
130 protected static $NAMESPACE_PF_ADM = null;
131 protected static $NAMESPACE_LOGIN =
'urn:es:gva:gvlogin:sso:model';
132 protected static $NAMESPACE_REGDEPARTAMENTAL =
'urn:es:gva:mastin:departamental:model';
133 protected static $NAMESPACE_DGT_CONDUCTORVEHICULOS =
'http://intermediacion.redsara.es/scsp/esquemas/datosespecificos';
134 protected static $NAMESPACE_DGT_DATOSVEHICULO =
'http://intermediacion.redsara.es/scsp/esquemas/datosespecificos';
148 private $WSDLTimeOut;
155 protected $v_clienteWS;
170 protected $passPhrase=null;
177 private $certFile=
'';
200 protected $vTrazabilidad;
224 protected $userToken =
'';
232 protected $passUserToken =
'';
240 protected $enableTrazabilidadPAI =
true;
248 protected $enableWSSecurity =
true;
268 if (!is_array($v_wsdl))
271 __CLASS__.
':'.__METHOD__.
'['.__FILE__.
'-'.__LINE__.
']'.
272 'v_wsdl debe ser un array asociativo (autenticacion,autorizacion,firma) con las URI de los WSDL' 276 $this->v_wsdl = $v_wsdl;
279 $this->v_clienteWS = array
281 self::KEYCLIENTE_AUTENTICA => null,
282 self::KEYCLIENTE_AUTORIZA => null,
283 self::KEYCLIENTE_CATASTRO => null,
284 self::KEYCLIENTE_CATASTRO_BIENES => null,
285 self::KEYCLIENTE_CSV => null,
286 self::KEYCLIENTE_FIRMA => null,
287 self::KEYCLIENTE_GDE => null,
288 self::KEYCLIENTE_GDE2 => null,
289 self::KEYCLIENTE_PF => null,
290 self::KEYCLIENTE_PF_ADM => null,
291 self::KEYCLIENTE_PF_MOD => null,
292 self::KEYCLIENTE_SALT => null,
293 self::KEYCLIENTE_GVLOGIN => null,
294 self::KEYCLIENTE_REGDEPARTAMENTAL => null,
295 self::KEYCLIENTE_DGT_CONDUCTORVEHICULOS => null,
296 self::KEYCLIENTE_DGT_DATOSVEHICULO => null
300 $this->nsCert = null;
301 $this->enableWSSecurity =
true;
302 $this->enableTrazabilidadPAI =
true;
305 if (is_array($v_opciones))
308 if (array_key_exists(
'certFile', $v_opciones))
310 $this->setCertFile($v_opciones[
'certFile']);
311 $this->nsCert = $this->getCertificateSerial();
314 if (array_key_exists(
'keyFile', $v_opciones))
316 $this->setKeyFile($v_opciones[
'keyFile']);
319 if (array_key_exists(
'passPhrase', $v_opciones))
321 $this->setPassPhrase($v_opciones[
'passPhrase']);
324 if (array_key_exists(
'enableWSSecurity', $v_opciones))
326 $this->enableWSSecurity = $v_opciones[
'enableWSSecurity'] &&
true;
329 if (array_key_exists(
'userToken', $v_opciones))
331 $this->userToken = $v_opciones[
'userToken'];
334 if (array_key_exists(
'passUserToken', $v_opciones))
336 $this->passUserToken = $v_opciones[
'passUserToken'];
339 if (array_key_exists(
'enableTrazabilidadPAI', $v_opciones))
341 $this->enableTrazabilidadPAI = $v_opciones[
'enableTrazabilidadPAI'] &&
true;
345 if (array_key_exists(
'idApp', $v_opciones))
347 $this->idApp = $v_opciones[
'idApp'];
351 $this->vTrazabilidad = array
353 'idApp' => $this->idApp,
354 'nsCert'=> $this->nsCert
358 $this->setDebugMode(
DEBUG);
359 $this->_debugInfo = array();
360 $this->WSDLTimeOut = 20;
377 public static function makeWSClient($wsID, $v_wsdl, $v_opciones=null)
383 case self::KEYCLIENTE_CATASTRO:
384 case self::KEYCLIENTE_CATASTRO_BIENES:
385 require_once
'WS/CATASTRO/WSClientCatastro.php';
386 require_once
'WS/CATASTRO/ComposerCatastro.php';
387 require_once
'WS/CATASTRO/objCatastro.php';
393 case self::KEYCLIENTE_CSV:
394 require_once
'WS/CSV/WSClientCSV.php';
400 case self::KEYCLIENTE_AUTENTICA:
401 require_once
'WS/SAFE/WSClientAutentica.php';
405 case self::KEYCLIENTE_AUTORIZA:
406 require_once
'WS/SAFE/WSClientAutoriza.php';
410 case self::KEYCLIENTE_FIRMA:
411 require_once
'WS/SAFE/WSClientFirma.php';
416 case self::KEYCLIENTE_GDE:
417 require_once
'WS/GDE/WSClientGDE.php';
422 case self::KEYCLIENTE_GDE2:
423 require_once
'WS/GDE/WSClientGDE2.php';
424 require_once
'WS/GDE/ComposerGDE2.php';
429 case self::KEYCLIENTE_SALT:
430 require_once
'WS/SALT/WSClientSALT.php';
436 case self::KEYCLIENTE_GVLOGIN:
437 require_once
'WS/GVLOGIN/WSClientGVLogin.php';
443 case self::KEYCLIENTE_PF:
444 case self::KEYCLIENTE_PF_MOD:
445 case self::KEYCLIENTE_PF_ADM:
446 require_once
'WS/PORTAFIRMAS/WSClientPortafirmas.php';
447 require_once
'WS/PORTAFIRMAS/ComposerPortafirmas.php';
453 case self::KEYCLIENTE_REGDEPARTAMENTAL:
454 require_once
'WS/REGDEPARTAMENTAL/WSClientRegDepartamental.php';
455 require_once
'WS/REGDEPARTAMENTAL/ComposerRegDepartamental.php';
461 case self::KEYCLIENTE_DGT_CONDUCTORVEHICULOS:
462 require_once
'WS/DGT/CONDUCTORVEHICULOS/WSClientConductorVehiculos.php';
463 require_once
'WS/DGT/CONDUCTORVEHICULOS/Composer.php';
469 case self::KEYCLIENTE_DGT_DATOSVEHICULO:
470 require_once
'WS/DGT/DATOSVEHICULO/WSClientDatosVehiculo.php';
471 require_once
'WS/DGT/DATOSVEHICULO/Composer.php';
481 error_log(
'Clave cliente no reconocida. ('.$wsClient.
')');
486 if (is_array($v_opciones))
489 if (array_key_exists(
'certFile', $v_opciones))
491 $wsClient->setCertFile($v_opciones[
'certFile']);
492 $wsClient->nsCert = $wsClient->getCertificateSerial();
495 if (array_key_exists(
'keyFile', $v_opciones))
497 $wsClient->setKeyFile($v_opciones[
'keyFile']);
500 if (array_key_exists(
'passPhrase', $v_opciones))
502 $wsClient->setPassPhrase($v_opciones[
'passPhrase']);
505 if (array_key_exists(
'enableWSSecurity', $v_opciones))
507 $wsClient->enableWSSecurity = $v_opciones[
'enableWSSecurity'] &&
true;
510 if (array_key_exists(
'userToken', $v_opciones))
512 $wsClient->userToken = $v_opciones[
'userToken'];
515 if (array_key_exists(
'passUserToken', $v_opciones))
517 $wsClient->passUserToken = $v_opciones[
'passUserToken'];
520 if (array_key_exists(
'enableTrazabilidadPAI', $v_opciones))
522 $wsClient->enableTrazabilidadPAI = $v_opciones[
'enableTrazabilidadPAI'] &&
true;
526 if (array_key_exists(
'idApp', $v_opciones))
528 $wsClient->idApp = $v_opciones[
'idApp'];
531 $wsClient->loadTracertPAI($v_opciones);
547 return($this->_debugMode);
559 return $this->_debugInfo;
572 self::$MYSOAPOP_TRACE =
true;
573 $this->_debugMode = $activo;
576 self::$MYSOAPOP_WSDL_CACHE = WSDL_CACHE_NONE;
580 self::$MYSOAPOP_WSDL_CACHE = WSDL_CACHE_MEMORY;
581 $this->_debugInfo = array();
596 $this->_debugInfo[] = $info;
611 $this->keyFile = $pathKey;
623 $this->passPhrase = $passphrase;
635 $this->certFile = $pathCert;
647 $this->WSDLTimeOut = $segs;
660 if (empty($this->certFile))
662 throw new Exception(
'No se ha fijado valor para el certificado o el mismo no existe.');
665 $certFile = realpath($this->certFile);
666 if ($certFile ===
false)
668 throw new Exception(
'No existe el fichero de cetificado: '.$this->certFile);
671 $cert = file_get_contents($certFile);
674 throw new Exception(
'No puede leerse el certificado : '.$certFile);
677 $v_certData = openssl_x509_parse($cert,
true);
678 $nsCert = strtoupper(self::numberBaseConvert($v_certData[
'serialNumber']));
681 $this->nsCert = $nsCert;
699 $certPath = realpath($ruta);
701 $certContent = file_get_contents($certPath);
702 if ($certContent ===
false)
705 __CLASS__.
':'.__METHOD__.
'['.__FILE__.
']-L'.__LINE__.
706 '. El certificado no se encuentra en la ruta: '.$certPath
712 $formato = pathinfo($certPath, PATHINFO_EXTENSION);
715 $formato = trim(strtoupper($formato));
720 $v_certPEM = array();
721 openssl_pkcs12_read($certContent, $v_certPEM,
'');
722 $cert = $v_certPEM[
'cert'];
727 $cert = $certContent;
731 $v_certData = openssl_x509_parse($cert,
true);
732 if ($v_certData ===
false)
735 __CLASS__.
':'.__METHOD__.
'['.__FILE__.
']-L'.__LINE__.
'.'.
736 'El formato del certificado no se corresponde con '.$formato
754 if (!is_array($vTrazabilidadPAI))
756 throw new Exception(
'Las opciones de trazabilidad deben ser un array asociativo [idApp, nsCert]');
759 if (array_key_exists(
'idApp', $vTrazabilidadPAI))
761 $this->idApp = $vTrazabilidadPAI[
'idApp'];
764 if (array_key_exists(
'nsCert', $vTrazabilidadPAI))
766 $this->nsCert = $vTrazabilidadPAI[
'nsCert'];
777 $this->enableWSSecurity =
true;
787 $this->enableWSSecurity =
false;
797 $this->enableTrazabilidadPAI =
true;
807 $this->enableTrazabilidadPAI =
false;
822 if (empty($tipo))
return null;
824 $tipo = trim(strtolower($tipo));
827 $this->__clienteOn($tipo);
829 if (!is_object($this->v_clienteWS[$tipo]))
832 return ($this->v_clienteWS[$tipo]);
857 protected function __clienteOn($tipo, $trazabilidadPai=
true, $opcionesClienteWS = null)
859 $vTiposCliente = array();
862 $tipo = trim(strtolower($tipo));
864 if (array_key_exists($tipo, $this->v_clienteWS))
866 $vTiposCliente = array($tipo);
870 if ($this->getDebugMode())
872 $this->addDebugInfo(__CLASS__.
':'.__METHOD__.
'['.__FILE__.
'-'.__LINE__.
']'.
' Tipo de cliente WS ('.$tipo.
') no reconocido.');
875 __CLASS__.
':'.__METHOD__.
'['.__FILE__.
']-L'.__LINE__.
'.'.
876 'Tipo de cliente WS ('.$tipo.
') no reconocido' 881 $streamContext = stream_context_create (
884 'verify_peer' =>
false,
885 'verify_peer_name' =>
false,
886 'allow_self_signed' =>
true 889 'user_agent' =>
'WSSSoapClient',
890 'timeout' => $this->WSDLTimeOut
893 'timeout' => $this->WSDLTimeOut
898 if (!is_array($opcionesClienteWS))
904 $opcionesClienteWS = array (
905 'soap_version' => SOAP_1_1,
906 'stream_context' => $streamContext,
907 'user_agent' =>
'WSSSoapClient',
908 'exceptions' =>
true,
909 'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
910 'trace' => self::$MYSOAPOP_TRACE
915 $opcionesClienteWS[
'soap_version'] = SOAP_1_1;
917 $opcionesClienteWS[
'user_agent'] =
'WSSSoapClient';
918 $opcionesClienteWS[
'exceptions'] =
true;
919 $opcionesClienteWS[
'cache_wsdl'] = self::$MYSOAPOP_WSDL_CACHE;
920 $opcionesClienteWS[
'trace'] = self::$MYSOAPOP_TRACE;
923 if ($this->getDebugMode())
925 $this->addDebugInfo(
"Opciones:\n ".print_r($opcionesClienteWS,
true));
928 foreach ($vTiposCliente as $claveTipo)
930 if (is_object($this->v_clienteWS[$claveTipo]))
continue;
934 if (ini_get(
'allow_url_fopen') ==
true)
936 $fd = fopen($this->v_wsdl[$claveTipo],
'r',
false, $streamContext);
939 throw new Exception(
'allow_url_fopen activo. La URL '.$this->v_wsdl[$claveTipo].
' no puede alcanzarse.');
994 if ($this->getDebugMode())
996 $this->addDebugInfo(__CLASS__.
':'.__METHOD__.
'['.__FILE__.
'-'.__LINE__.
']'.
' allow_url_fopen NO ACTIVO y Extensión CURL NO ACTIVA');
1001 $clienteWS =
new WSSSoapClient($this->v_wsdl[$claveTipo], $opcionesClienteWS);
1003 if ($this->enableWSSecurity ==
true)
1005 $clienteWS->setCertFile($this->certFile);
1006 $clienteWS->setKeyFile($this->keyFile);
1007 $clienteWS->setPassPhrase($this->passPhrase);
1008 $clienteWS->setUserToken($this->userToken, $this->passUserToken);
1009 $clienteWS->enableWSSecurity();
1013 $clienteWS->disableWSSecurity();
1016 if ($this->enableTrazabilidadPAI)
1018 $clienteWS->loadTracertPAI($this->vTrazabilidad);
1020 $this->v_clienteWS[$claveTipo] = $clienteWS;
1024 if ($this->getDebugMode())
1026 $this->addDebugInfo(__CLASS__.
':'.__METHOD__.
'['.__FILE__.
'-'.__LINE__.
']'.
"\n");
1027 if (is_object($clienteWS))
1029 $this->addDebugInfo(
"RqH:\n ".$clienteWS->__getLastRequestHeaders());
1030 $this->addDebugInfo(
"Rq:\n ".$clienteWS->__getLastRequest());
1031 $this->addDebugInfo(
"RsH:\n ".$clienteWS->__getLastResponse());
1032 $this->addDebugInfo(
"Rs:\n ".$clienteWS->__getLastResponseHeaders());
1035 $this->addDebugInfo(
"\n");
1053 if (!is_array($array))
return;
1055 if (is_numeric(key($array)))
1057 foreach ($array as $key => $value)
1059 $array[$key] = $this->array2ObjectTree($value);
1064 foreach ($array as $key => $value)
1066 if (is_array($value))
1068 $Object->$key = $this->array2ObjectTree($value);
1072 $Object->$key = $value;
1087 if (is_array($obj) || is_object($obj))
1090 foreach ($obj as $key => $value)
1092 $result[$key] = $this->objectTree2array($value);
1100 protected function tratarExcepcionEstandar($e, $clienteWS)
1103 WSComunPAIException::tryToThrow($e);
1106 if ($this->getDebugMode())
1108 $this->addDebugInfo(__CLASS__.
':'.__METHOD__.
'['.__FILE__.
'-'.__LINE__.
']'.
"\n");
1109 if (is_object($clienteWS))
1111 $this->addDebugInfo(
"RqH:\n ".$clienteWS->__getLastRequestHeaders());
1112 $this->addDebugInfo(
"Rq:\n ".$clienteWS->__getLastRequest());
1113 $this->addDebugInfo(
"RsH:\n ".$clienteWS->__getLastResponse());
1114 $this->addDebugInfo(
"Rs:\n ".$clienteWS->__getLastResponseHeaders());
1138 $mimeBoundary =
'--MIME_Boundary';
1139 $vBodyResponse = explode($mimeBoundary, $response);
1140 $numElementos = count($vBodyResponse);
1143 if ($numElementos<=1)
1145 $mimeBoundary =
'--uuid:';
1146 $vBodyResponse = explode($mimeBoundary, $response);
1147 $numElementos = count($vBodyResponse);
1148 $srcData = $response;
1150 elseif ($numElementos>1)
1152 $srcData = $vBodyResponse[1];
1155 $vRespuesta = array();
1156 ini_set(
'pcre.backtrack_limit',
'100000000');
1157 preg_match(
"/<[a-z]*:Envelope.*?>(.*)<\/[a-z]*:Envelope>/is", $srcData, $vRespuesta);
1158 if (preg_last_error()!=PREG_NO_ERROR)
1161 $start = stripos($srcData,
':Envelope');
1162 $start = strripos($srcData,
'<', $start - strlen($srcData));
1163 $end = strripos($srcData,
':Envelope>');
1164 $cadenaRespuesta = substr($srcData, $start, $end);
1166 elseif (count($vRespuesta)<1)
1168 throw new Exception(
'No puede ubicarse RESPONSE dentro de MTOM');
1172 $cadenaRespuesta = $vRespuesta[0];
1177 $dom->loadXML($cadenaRespuesta);
1178 $xpath = new \DOMXpath($dom);
1179 $vNodoRespuesta = $xpath->query(
"/*[local-name()='Envelope']/*[local-name()='Body']/*/*[local-name()='respuesta']");
1181 if (!empty($itemToReturn))
1183 $subStrXpath =
"/*[local-name()='{$itemToReturn}']";
1185 $vNodoRespuesta = $xpath->query(
"/*[local-name()='Envelope']/*[local-name()='Body']/*".$subStrXpath);
1186 $nodoRespuesta = $vNodoRespuesta->item(0);
1188 if ($numElementos>0)
1191 $oMime = $oMimeParser->decodeMTOM($vBodyResponse);
1192 unset($oMime->body);$oMime->body=null;gc_collect_cycles();
1194 $vNodoInclude = $xpath->query(
"//*[local-name()='Include']");
1195 foreach ($vNodoInclude as $nodoItem)
1197 $subIdBuscado = (string) $nodoItem->getAttribute(
'href');
1198 $subIdBuscado = urldecode($subIdBuscado);
1199 $idBuscado =
'<'.substr($subIdBuscado, 4).
'>';
1200 foreach ($oMime->parts as &$parte)
1202 if ($idBuscado == ($parte->headers[
'content-id']))
1204 if ( strtolower(substr($parte->mimetype, 0, 4)) !==
'text')
1206 $parte->body = base64_encode($parte->body);
1208 $textNode = $dom->createTextNode(($parte->body));
1209 $nodoItem->parentNode->replaceChild($textNode, $nodoItem);
1214 return($this->xml_to_array($nodoRespuesta));
1220 protected function xml_to_array(&$root)
1223 if ($root->hasAttributes())
1225 $attrs = $root->attributes;
1226 foreach ($attrs as $attr)
1228 $result[
'@attributes'][$attr->name] = $attr->value;
1231 if ($root->hasChildNodes())
1233 $children = $root->childNodes;
1234 if ($children->length == 1)
1236 $child = $children->item(0);
1237 if ($child->nodeType == XML_TEXT_NODE)
1239 $result[
'_value'] = $child->nodeValue;
1240 return count($result) == 1 ? $result[
'_value'] : $result;
1244 foreach ($children as $child)
1246 if (!isset($result[$child->nodeName]))
1248 $result[$child->nodeName] = $this->xml_to_array($child);
1252 if (!isset($groups[$child->nodeName]))
1254 $result[$child->nodeName] = array($result[$child->nodeName]);
1255 $groups[$child->nodeName] = 1;
1257 $result[$child->nodeName][] = $this->xml_to_array($child);
1278 $chars =
"0123456789abcdefghijklmnopqrstuvwxyz";
1279 $tostring = substr($chars, 0, $tobase);
1280 $length = strlen($numstring);
1283 for ($i = 0; $i < $length; $i++)
1285 $number[$i] = strpos($chars, $numstring{$i});
1291 for ($i = 0; $i < $length; $i++)
1293 $divide = $divide * $frombase + $number[$i];
1294 if ($divide >= $tobase)
1296 $number[$newlen++] = (int)($divide / $tobase);
1297 $divide = $divide % $tobase;
1298 } elseif ($newlen > 0)
1300 $number[$newlen++] = 0;
1304 $result = $tostring{$divide} . $result;
1305 }
while ($newlen != 0);
1317 if (getenv(
'HTTP_CLIENT_IP'))
1319 $ip = getenv(
'HTTP_CLIENT_IP');
1321 else if(getenv(
'HTTP_X_FORWARDED_FOR'))
1323 $ip = getenv(
'HTTP_X_FORWARDED_FOR');
1325 else if (getenv(
'HTTP_X_FORWARDED'))
1327 $ip = getenv(
'HTTP_X_FORWARDED');
1329 else if(getenv(
'HTTP_FORWARDED_FOR'))
1331 $ip = getenv(
'HTTP_FORWARDED_FOR');
1333 else if(getenv(
'HTTP_FORWARDED'))
1335 $ip = getenv(
'HTTP_FORWARDED');
1337 else if(getenv(
'REMOTE_ADDR'))
1339 $ip = getenv(
'REMOTE_ADDR');
1365 const ERROR_SERVICIO =
'0101';
1366 const TIMESTAMP_INVALIDO =
'0230';
1367 const ORGANISMO_NO_AUTORIZADO =
'0301';
1368 const CERTIFICADO_CADUCADO =
'0302';
1369 const CERTIFICADO_REVOCADO =
'0303';
1370 const FIRMA_PETICION_NO_VALIDA =
'0305';
1371 const PETICION_SIN_NODO_FIRMA =
'0307';
1372 const ESTRUCURA_XML_NO_CORRESPONDE_A_ESQUEMA =
'0401';
1373 const MENSAJE_XML_INVALIDO =
'0403';
1374 const OPERACION_SOLICITADA_INCORRECTA =
'0800';
1375 const FALTA_CABECERA_TRAZABILIDAD =
'0807';
1376 const INFO_TRAZABILIDAD_INCOHERENTE =
'0808';
1377 const ERROR_GENERAL_INDEFINIDO =
'0904';
1380 private $CodigoEstado =
'';
1381 private $CodigoEstadoSecundario =
'';
1382 private $LiteralError =
'';
1383 private $LiteralErrorSec =
'';
1385 public function getCodigoEstado() {
1386 return $this->CodigoEstado;
1388 public function getCodigoEstadoSecundario() {
1389 return $this->CodigoEstadoSecundario;
1391 public function getLiteralError() {
1392 return $this->LiteralError;
1394 public function getLiteralErrorSec() {
1395 return $this->LiteralErrorSec;
1400 public function __construct($soapFault) {
1402 $faultCode = intval($soapFault->detail->Atributos->Estado->CodigoEstado);
1403 $faultString = $soapFault->detail->Atributos->Estado->LiteralError;
1406 parent::__construct($faultString, $faultCode, $soapFault);
1409 $this->CodigoEstado = $soapFault->detail->Atributos->Estado->CodigoEstado;
1410 $this->CodigoEstadoSecundario = $soapFault->detail->Atributos->Estado->CodigoEstadoSecundario;
1411 $this->LiteralError = $soapFault->detail->Atributos->Estado->LiteralError;
1412 $this->LiteralErrorSec = $soapFault->detail->Atributos->Estado->LiteralErrorSec;
1415 public function __toString() {
1416 return __CLASS__ .
": [{$this->code}] {$this->message}\n";
1430 if (($e instanceof \SoapFault) && ($e->faultcode ==
'soap-env:PAI')) {
tratarMTOMEstandar($response, $itemToReturn=null)
static numberBaseConvert($numstring, $frombase=10, $tobase=16)
__construct($v_wsdl, $v_opciones=null)
static getCertificateInfo($ruta, $formato=null)
setPassPhrase($passphrase)
loadTracertPAI($vTrazabilidadPAI)
__clienteOn($tipo, $trazabilidadPai=true, $opcionesClienteWS=null)
getCertificateSerial($set=true)