WSCOMUN  2.1.2
Web Services Comunes para PHP/GVHidra
WSClientGDE2.php
1 <?php
2 namespace WSCOMUN\GDE;
4 
16 {
17 
22  const URL_FRONT_DESARROLLO = 'https://previs.gva.es/gde-front/';
23  const URL_FRONT_PRODUCCION = 'https://www.tramita.gva.es/gde-front/';
24 
25 
46  public function insertarDocumento($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo = null, $vMetadatosENI = null, $vMetadatosPersonalizados=null, $vFirmas=null)
47  {
48  try
49  {
50  $this->__clienteOn(self::KEYCLIENTE_GDE2, true);
51  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_GDE2];
52 
53  $composer = new ComposerGDE2();
54  $peticionWSRequest = $composer->__cde__insertarDocumento_full(
55  array(
56  'contenido' => $docContentB64,
57  'nombre' => $nombreDoc,
58  'path' => $pathDoc,
59  'tipoPersonalizado' => $tipo,
60  'metadatosENI' => $vMetadatosENI,
61  'coleccionMetadatosPersonalizados' => $vMetadatosPersonalizados,
62  'firmas' => $vFirmas
63  ), 'peticion', self::$NAMESPACE_GDE2);
64 
65  $insertarDocumentoWSRequest = new \ArrayObject();
66  $insertarDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
67  $insertarDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
68 
69  $miSoapRQ = new \SoapVar($insertarDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'insertarDocumento', self::$NAMESPACE_GDE2);
70  $respuesta = $clienteWS->insertarDocumento($miSoapRQ);
71 
72  $vRespuesta = array();
73  if (is_object($respuesta))
74  {
75  $vRespuesta = $this->objectTree2array($respuesta);
76  }
77  return($vRespuesta);
78  }
79  catch (\Exception $e)
80  {
81  // Comprobamos si estamos ante excepcion MTOM
82  $mensaje = $e->getMessage();
83  $mensaje = trim(strtolower($mensaje));
84  switch ($mensaje)
85  {
86  case 'looks like we got no xml document' :
87  // Obtiene la respuesta
88  $response = $clienteWS->__getLastResponse();
89  $respuesta = $this->tratarMTOMEstandar($response);
90  return $respuesta;
91  break;
92 
93  default:
94  $this->aislarExcepcionGDE($e, $clienteWS);
95  break;
96  }
97  }
98  }//insertarDocumento
99 
100 
101 
112  public function obtenerDocumento($codApp, $refDoc, $parcial='1')
113  {
114  //$this->setDebugMode(true);
115  try
116  {
117  $opcionesClienteWS = array (
118  'soap_version' => SOAP_1_1, //SOAP 1.2
119  'user_agent' => 'WSSSoapClient',
120  'exceptions' => true,
121  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
122  'trace' => self::$MYSOAPOP_TRACE
123  );
124 
125  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
126  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
127 
128  $composer = new ComposerGDE2();
129  $peticionWSRequest = $composer->__cde__obtenerDocumento_full(
130  array(
131  'referenciaDocumento' => $refDoc ,
132  'parcial' => $parcial
133  ), 'peticion', self::$NAMESPACE_GDE2);
134 
135  $obtenerDocumentoWSRequest = new \ArrayObject();
136  $obtenerDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
137  $obtenerDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
138 
139  $miSoapRQ = new \SoapVar($obtenerDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'obtenerDocumento', self::$NAMESPACE_GDE2);
140  $respuesta = $clienteWS->obtenerDocumento($miSoapRQ);
141 
142  $vRespuesta = array();
143  if (is_object($respuesta))
144  {
145  $vRespuesta = $this->objectTree2array($respuesta);
146  }
147  return($vRespuesta);
148  }
149  catch (\Exception $e)
150  {
151  // Comprobamos si estamos ante excepcion MTOM
152  $mensaje = $e->getMessage();
153  $mensaje = trim(strtolower($mensaje));
154  switch ($mensaje)
155  {
156  case 'looks like we got no xml document' :
157  // Obtiene la respuesta
158  $response = $clienteWS->__getLastResponse();
159  // Realiza la interpretacion/sustitucion estandar de MTOM
160  $vRetorno = $this->tratarMTOMEstandar($response);
161  return ($vRetorno);
162 
163  case 'gde_documentonoexistenteexception':
164  return array(
165  'respuesta' => array('correcto'=>'false'),
166  'codMotivo' => 'NOEXISTE',
167  'motivo' => 'No existe ningún documento con la referencia '.$refDoc
168  );
169  break;
170 
171  default:
172  $this->aislarExcepcionGDE($e, $clienteWS);
173  break;
174  }
175  }
176  }//obtenerDocumento
177 
178 
188  public function eliminarDocumento($codApp, $refDoc)
189  {
190  //$this->setDebugMode(true);
191  try
192  {
193  $opcionesClienteWS = array (
194  'soap_version' => SOAP_1_1, //SOAP 1.2
195  'user_agent' => 'WSSSoapClient',
196  'exceptions' => true,
197  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
198  'trace' => self::$MYSOAPOP_TRACE
199  );
200 
201  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
202  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
203 
204  $composer = new ComposerGDE2();
205  $peticionWSRequest = $composer->__cde__eliminarDocumento_full(
206  array(
207  'referenciaDocumento' => $refDoc
208  ), 'peticion', self::$NAMESPACE_GDE2);
209 
210  $mainWS = new \ArrayObject();
211  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
212  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
213 
214  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'eliminarDocumento', self::$NAMESPACE_GDE2);
215  $respuesta = $clienteWS->eliminarDocumento($miSoapRQ);
216 
217  $vRespuesta = array();
218  if (is_object($respuesta))
219  {
220  $vRespuesta = $this->objectTree2array($respuesta);
221  }
222  return($vRespuesta);
223  }
224  catch (\Exception $e)
225  {
226  // Comprobamos si estamos ante excepcion MTOM
227  $mensaje = $e->getMessage();
228  $mensaje = trim(strtolower($mensaje));
229  switch ($mensaje)
230  {
231  case 'looks like we got no xml document' :
232  // Obtiene la respuesta
233  $response = $clienteWS->__getLastResponse();
234  // Realiza la interpretacion/sustitucion estandar de MTOM
235  $vRetorno = $this->tratarMTOMEstandar($response);
236  return $vRetorno;
237  break;
238 
239  case 'gde_gestordocumentalexception' :
240  $mensaje = $e->detail->ExcepcionWS->detalleError;
241  $mensaje = trim(strtolower($mensaje));
242  if (strpos($mensaje, 'ya estaba borrado')===false)
243  {
244  $this->tratarExcepcionEstandar($e, $clienteWS);
245  }
246  else
247  {
248  return array(
249  'respuesta' => array('correcto'=>'false'),
250  'codMotivo' => 'PREBORRADO',
251  'motivo' => 'El documento ya había sido borrado'
252  );
253  }
254  break;
255 
256  case 'gde_documentonoexistenteexception':
257  return array(
258  'respuesta' => array('correcto'=>'false'),
259  'codMotivo' => 'NOEXISTE',
260  'motivo' => 'No existe ningún documento con la referencia '.$refDoc
261  );
262  break;
263 
264  default:
265  $this->aislarExcepcionGDE($e, $clienteWS);
266  break;
267  }
268  }//Fin catch
269  }//eliminarDocumento
270 
271 
272 
280  public function asociarFirmas($codApp, $refDoc, $vFirmas)
281  {
282 
283  //$this->setDebugMode(true);
284  try
285  {
286  $opcionesClienteWS = array (
287  'soap_version' => SOAP_1_1, //SOAP 1.2
288  'user_agent' => 'WSSSoapClient',
289  'exceptions' => true,
290  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
291  'trace' => self::$MYSOAPOP_TRACE
292  );
293 
294  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
295  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
296 
297 
298  $composer = new ComposerGDE2();
299  $peticionWSRequest = $composer->__cde__asociarFirmas_full(array('referenciaDocumento' => $refDoc, 'firmas' => $vFirmas), 'peticion', self::$NAMESPACE_GDE2);
300 
301  $mainWS = new \ArrayObject();
302  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
303  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
304 
305  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'asociarFirmas', self::$NAMESPACE_GDE2);
306  $respuesta = $clienteWS->asociarFirmas($miSoapRQ);
307 
308  $vRespuesta = array();
309  if (is_object($respuesta))
310  {
311  $vRespuesta = $this->objectTree2array($respuesta);
312  }
313  return($vRespuesta);
314  }
315  catch (\Exception $e)
316  {
317  // Comprobamos si estamos ante excepcion MTOM
318  $mensaje = $e->getMessage();
319  $mensaje = trim(strtolower($mensaje));
320  switch ($mensaje)
321  {
322  case 'looks like we got no xml document' :
323  // Obtiene la respuesta
324  $response = $clienteWS->__getLastResponse();
325  $respuesta = $this->tratarMTOMEstandar($response);
326  return $respuesta;
327  break;
328 
329  default:
330  $this->aislarExcepcionGDE($e, $clienteWS);
331  break;
332  }
333  }
334  }//asociarFirmas
335 
336 
337 
354  public function buscarDocCriterio($codApp, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
355  {
356  try
357  {
358  $opcionesClienteWS = array (
359  'soap_version' => SOAP_1_1, //SOAP 1.2
360  'user_agent' => 'WSSSoapClient',
361  'exceptions' => true,
362  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
363  'trace' => self::$MYSOAPOP_TRACE
364  );
365 
366  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
367  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
368 
369 
370  $composer = new ComposerGDE2();
371  $peticionWSRequest = $composer->__cde__buscarDocCriterio_full(array('filtroPath' => $filtroPath, 'buscarInTree' => $buscarInTree, 'operacion' => $operacion, 'coleccionCriterios' => $coleccionCriterios), 'peticion', self::$NAMESPACE_GDE2);
372 
373  $mainWS = new \ArrayObject();
374  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
375  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
376 
377  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'buscarDocCriterio', self::$NAMESPACE_GDE2);
378  $respuesta = $clienteWS->buscarDocCriterio($miSoapRQ);
379 
380  $vRespuesta = array();
381  if (is_object($respuesta))
382  {
383  $vRespuesta = $this->objectTree2array($respuesta);
384  }
385  return($vRespuesta);
386  }
387  catch (\Exception $e)
388  {
389  // Comprobamos si estamos ante excepcion MTOM
390  $mensaje = $e->getMessage();
391  $mensaje = trim(strtolower($mensaje));
392  switch ($mensaje)
393  {
394  case 'looks like we got no xml document' :
395  // Obtiene la respuesta
396  $response = $clienteWS->__getLastResponse();
397  $respuesta = $this->tratarMTOMEstandar($response);
398  return $respuesta;
399  break;
400 
401  default:
402  $this->aislarExcepcionGDE($e, $clienteWS);
403  break;
404  }
405  }
406  }//buscarDocCriterio
407 
408 
425  public function buscarDocCriterioPaginado($codApp, $registrosPagina, $pagina, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null) {
426  try
427  {
428  $opcionesClienteWS = array (
429  'soap_version' => SOAP_1_1, //SOAP 1.2
430  'user_agent' => 'WSSSoapClient',
431  'exceptions' => true,
432  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
433  'trace' => self::$MYSOAPOP_TRACE
434  );
435 
436  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
437  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
438 
439 
440  $composer = new ComposerGDE2();
441  $peticionWSRequest = $composer->__cde__buscarDocCriterioPaginado_full(array('paginacion' => array('registrosPagina' => $registrosPagina, 'pagina' => $pagina), 'filtroPath' => $filtroPath, 'buscarInTree' => $buscarInTree, 'operacion' => $operacion, 'coleccionCriterios' => $coleccionCriterios), 'peticion', self::$NAMESPACE_GDE2);
442 
443  $mainWS = new \ArrayObject();
444  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
445  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
446 
447  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'buscarDocCriterioPaginado', self::$NAMESPACE_GDE2);
448  $respuesta = $clienteWS->buscarDocCriterioPaginado($miSoapRQ);
449 
450  $vRespuesta = array();
451  if (is_object($respuesta))
452  {
453  $vRespuesta = $this->objectTree2array($respuesta);
454  }
455  return($vRespuesta);
456  }
457  catch (\Exception $e)
458  {
459  // Comprobamos si estamos ante excepcion MTOM
460  $mensaje = $e->getMessage();
461  $mensaje = trim(strtolower($mensaje));
462  switch ($mensaje)
463  {
464  case 'looks like we got no xml document' :
465  // Obtiene la respuesta
466  $response = $clienteWS->__getLastResponse();
467  $respuesta = $this->tratarMTOMEstandar($response);
468  return $respuesta;
469  break;
470 
471  default:
472  $this->aislarExcepcionGDE($e, $clienteWS);
473  break;
474  }
475  }
476  }//buscarDocCriterioPaginado
477 
478 
479 
488  public function crearCarpeta($codApp, $path, $tipo=null, $metadatosExpedienteEni=null, $coleccionMetadatosPersonalizados=null)
489  {
490  try
491  {
492  $opcionesClienteWS = array (
493  'soap_version' => SOAP_1_1, //SOAP 1.2
494  'user_agent' => 'WSSSoapClient',
495  'exceptions' => true,
496  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
497  'trace' => self::$MYSOAPOP_TRACE
498  );
499 
500  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
501  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
502 
503 
504  $composer = new ComposerGDE2();
505  $peticionWSRequest = $composer->__cde__crearCarpeta_full(
506  array(
507  'path' => $path,
508  'tipoPersonalizado' => $tipo,
509  'metadatosExpedienteEni' => $metadatosExpedienteEni,
510  'coleccionMetadatosPersonalizados' => $coleccionMetadatosPersonalizados
511  ), 'peticion', self::$NAMESPACE_GDE2);
512 
513  $mainWS = new \ArrayObject();
514  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
515  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
516 
517  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'crearCarpeta', self::$NAMESPACE_GDE2);
518  $respuesta = $clienteWS->crearCarpeta($miSoapRQ);
519 
520  $vRespuesta = array();
521  if (is_object($respuesta))
522  {
523  $vRespuesta = $this->objectTree2array($respuesta);
524  }
525  return($vRespuesta);
526  }
527  catch (\Exception $e)
528  {
529  return $this->tratarInnerException($clienteWS, $e);
530  }
531  }//crearCarpeta
532 
533 
540  public function eliminarCarpeta($codApp, $path)
541  {
542  //$this->setDebugMode(true);
543  try
544  {
545  $opcionesClienteWS = array (
546  'soap_version' => SOAP_1_1, //SOAP 1.2
547  'user_agent' => 'WSSSoapClient',
548  'exceptions' => true,
549  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
550  'trace' => self::$MYSOAPOP_TRACE
551  );
552 
553  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
554  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
555 
556 
557  $composer = new ComposerGDE2();
558  $peticionWSRequest = $composer->__cde__eliminarCarpeta_full(
559  array(
560  'path' => $path
561  ), 'peticion', self::$NAMESPACE_GDE2);
562 
563  $obtenerDocumentoWSRequest = new \ArrayObject();
564  $obtenerDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
565  $obtenerDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
566 
567  $miSoapRQ = new \SoapVar($obtenerDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'eliminarCarpeta', self::$NAMESPACE_GDE2);
568  $respuesta = $clienteWS->eliminarCarpeta($miSoapRQ);
569 
570  $vRespuesta = array();
571  if (is_object($respuesta))
572  {
573  $vRespuesta = $this->objectTree2array($respuesta);
574  }
575  return($vRespuesta);
576  }
577  catch (\Exception $e)
578  {
579  // Comprobamos si estamos ante excepcion MTOM
580  $mensaje = $e->getMessage();
581  $mensaje = trim(strtolower($mensaje));
582  switch ($mensaje)
583  {
584  case 'looks like we got no xml document' :
585  // Obtiene la respuesta
586  $response = $clienteWS->__getLastResponse();
587  $respuesta = $this->tratarMTOMEstandar($response);
588  return $respuesta;
589  break;
590 
591  default:
592  $this->aislarExcepcionGDE($e, $clienteWS);
593  break;
594  }
595  }
596  }//eliminarCarpeta
597 
598 
599 
607  public function empaquetarDocumentoENI($codApp, $contenido, $vMetadatosEni, $vFirmas) {
608 
609  //$this->setDebugMode(true);
610  try
611  {
612  $opcionesClienteWS = array (
613  'soap_version' => SOAP_1_1, //SOAP 1.2
614  'user_agent' => 'WSSSoapClient',
615  'exceptions' => true,
616  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
617  'trace' => self::$MYSOAPOP_TRACE
618  );
619 
620  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
621  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
622 
623 
624  $composer = new ComposerGDE2();
625  $peticionWSRequest = $composer->__cde__empaquetarDocumentoENI_full(array('contenido' => $contenido, 'metadatosENI' => $vMetadatosEni, 'firmas' => $vFirmas), 'peticion', self::$NAMESPACE_GDE2);
626 
627  $mainWS = new \ArrayObject();
628  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
629  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
630 
631 
632  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'empaquetarDocumentoENI', self::$NAMESPACE_GDE2);
633  $respuesta = $clienteWS->empaquetarDocumentoENI($miSoapRQ);
634 
635  $vRespuesta = array();
636  if (is_object($respuesta))
637  {
638  $vRespuesta = $this->objectTree2array($respuesta);
639  }
640  return($vRespuesta);
641  }
642  catch (\Exception $e)
643  {
644  // Comprobamos si estamos ante excepcion MTOM
645  $mensaje = $e->getMessage();
646  $mensaje = trim(strtolower($mensaje));
647  switch ($mensaje)
648  {
649  case 'looks like we got no xml document' :
650  // Obtiene la respuesta
651  $response = $clienteWS->__getLastResponse();
652  $respuesta = $this->tratarMTOMEstandar($response);
653  return $respuesta;
654  break;
655 
656  default:
657  $this->aislarExcepcionGDE($e, $clienteWS);
658  break;
659  }
660  }
661  }//empaquetarDocumentoENI
662 
663 
671  public function establecerMetadatoCarpetasPersonalizados($codApp, $path, $vColMetadatosPers) {
672  try
673  {
674  $opcionesClienteWS = array (
675  'soap_version' => SOAP_1_1, //SOAP 1.2
676  'user_agent' => 'WSSSoapClient',
677  'exceptions' => true,
678  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
679  'trace' => self::$MYSOAPOP_TRACE
680  );
681 
682  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
683  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
684 
685 
686  $composer = new ComposerGDE2();
687  $peticionWSRequest = $composer->__cde__establecerMetadatoCarpetasPersonalizados_full(array('path' => $path, 'coleccionMetadatosPersonalizados' => $vColMetadatosPers), 'peticion', self::$NAMESPACE_GDE2);
688 
689  $mainWS = new \ArrayObject();
690  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
691  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
692 
693 
694  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'establecerMetadatoCarpetasPersonalizados', self::$NAMESPACE_GDE2);
695  $respuesta = $clienteWS->establecerMetadatoCarpetasPersonalizados($miSoapRQ);
696 
697  $vRespuesta = array();
698  if (is_object($respuesta))
699  {
700  $vRespuesta = $this->objectTree2array($respuesta);
701  }
702  return($vRespuesta);
703  }
704  catch (\Exception $e)
705  {
706  // Comprobamos si estamos ante excepcion MTOM
707  $mensaje = $e->getMessage();
708  $mensaje = trim(strtolower($mensaje));
709  switch ($mensaje)
710  {
711  case 'looks like we got no xml document' :
712  // Obtiene la respuesta
713  $response = $clienteWS->__getLastResponse();
714  $respuesta = $this->tratarMTOMEstandar($response);
715  return $respuesta;
716  break;
717 
718  default:
719  $this->aislarExcepcionGDE($e, $clienteWS);
720  break;
721  }
722  }
723  }//establecerMetadatoCarpetasPersonalizados
724 
731  public function establecerMetadatosCarpetaExpedienteENI($codApp, $path, $vMetadatosExpedienteEni) {
732 
733  //$this->setDebugMode(true);
734  try
735  {
736  $opcionesClienteWS = array (
737  'soap_version' => SOAP_1_1, //SOAP 1.2
738  'user_agent' => 'WSSSoapClient',
739  'exceptions' => true,
740  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
741  'trace' => self::$MYSOAPOP_TRACE
742  );
743 
744  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
745  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
746 
747 
748  $composer = new ComposerGDE2();
749  $peticionWSRequest = $composer->__cde__establecerMetadatosCarpetaExpedienteENI_full(array('path' => $path, 'metadatosExpedienteEni' => $vMetadatosExpedienteEni), 'peticion', self::$NAMESPACE_GDE2);
750 
751  $mainWS = new \ArrayObject();
752  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
753  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
754 
755 
756  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'establecerMetadatosCarpetaExpedienteENI', self::$NAMESPACE_GDE2);
757  $respuesta = $clienteWS->establecerMetadatosCarpetaExpedienteENI($miSoapRQ);
758 
759  $vRespuesta = array();
760  if (is_object($respuesta))
761  {
762  $vRespuesta = $this->objectTree2array($respuesta);
763  }
764  return($vRespuesta);
765  }
766  catch (\Exception $e)
767  {
768  // Comprobamos si estamos ante excepcion MTOM
769  $mensaje = $e->getMessage();
770  $mensaje = trim(strtolower($mensaje));
771  switch ($mensaje)
772  {
773  case 'looks like we got no xml document' :
774  // Obtiene la respuesta
775  $response = $clienteWS->__getLastResponse();
776  $respuesta = $this->tratarMTOMEstandar($response);
777  return $respuesta;
778  break;
779 
780  default:
781  $this->aislarExcepcionGDE($e, $clienteWS);
782  break;
783  }
784  }
785  }//establecerMetadatosCarpetaExpedienteENI
786 
787 
797  public function establecerMetadatosENI($codApp, $refDoc, $vMetadatosEni)
798  {
799  //$this->setDebugMode(true);
800  try
801  {
802  $opcionesClienteWS = array (
803  'soap_version' => SOAP_1_1, //SOAP 1.2
804  'user_agent' => 'WSSSoapClient',
805  'exceptions' => true,
806  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
807  'trace' => self::$MYSOAPOP_TRACE
808  );
809 
810  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
811  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
812 
813 
814  $composer = new ComposerGDE2();
815  $peticionWSRequest = $composer->__cde__establecerMetadatosENI_full(array('referenciaDocumento' => $refDoc, 'metadatosENI' => $vMetadatosEni), 'peticion', self::$NAMESPACE_GDE2);
816 
817  $mainWS = new \ArrayObject();
818  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
819  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
820 
821 
822  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'establecerMetadatosENI', self::$NAMESPACE_GDE2);
823  $respuesta = $clienteWS->establecerMetadatosENI($miSoapRQ);
824 
825  $vRespuesta = array();
826  if (is_object($respuesta))
827  {
828  $vRespuesta = $this->objectTree2array($respuesta);
829  }
830  return($vRespuesta);
831  }
832  catch (\Exception $e)
833  {
834  // Comprobamos si estamos ante excepcion MTOM
835  $mensaje = $e->getMessage();
836  $mensaje = trim(strtolower($mensaje));
837  switch ($mensaje)
838  {
839  case 'looks like we got no xml document' :
840  // Obtiene la respuesta
841  $response = $clienteWS->__getLastResponse();
842  $respuesta = $this->tratarMTOMEstandar($response);
843  return $respuesta;
844  break;
845 
846  default:
847  $this->aislarExcepcionGDE($e, $clienteWS);
848  break;
849  }
850  }
851  }//establecerMetadatosENI
852 
853 
860  public function establecerMetadatosPersonalizados($codApp, $refDoc, $coleccionMetadatosPersonalizados)
861  {
862  try
863  {
864  $opcionesClienteWS = array (
865  'soap_version' => SOAP_1_1, //SOAP 1.2
866  'user_agent' => 'WSSSoapClient',
867  'exceptions' => true,
868  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
869  'trace' => self::$MYSOAPOP_TRACE
870  );
871 
872  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
873  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
874 
875 
876  $composer = new ComposerGDE2();
877  $peticionWSRequest = $composer->__cde__establecerMetadatosPersonalizados_full(array('referenciaDocumento' => $refDoc, 'coleccionMetadatosPersonalizados' => $coleccionMetadatosPersonalizados), 'peticion', self::$NAMESPACE_GDE2);
878 
879  $mainWS = new \ArrayObject();
880  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
881  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
882 
883 
884  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'establecerMetadatosPersonalizados', self::$NAMESPACE_GDE2);
885  $respuesta = $clienteWS->establecerMetadatosPersonalizados($miSoapRQ);
886 
887  $vRespuesta = array();
888  if (is_object($respuesta))
889  {
890  $vRespuesta = $this->objectTree2array($respuesta);
891  }
892  return($vRespuesta);
893  }
894  catch (\Exception $e)
895  {
896  // Comprobamos si estamos ante excepcion MTOM
897  $mensaje = $e->getMessage();
898  $mensaje = trim(strtolower($mensaje));
899  switch ($mensaje)
900  {
901  case 'looks like we got no xml document' :
902  // Obtiene la respuesta
903  $response = $clienteWS->__getLastResponse();
904  $respuesta = $this->tratarMTOMEstandar($response);
905  return $respuesta;
906  break;
907 
908  default:
909  $this->aislarExcepcionGDE($e, $clienteWS);
910  break;
911  }
912  }
913  }//establecerMetadatosPersonalizados
914 
915 
920  public function generarIdentificadorENI($codApp)
921  {
922 
923  //$this->setDebugMode(true);
924  try
925  {
926  $opcionesClienteWS = array (
927  'soap_version' => SOAP_1_1, //SOAP 1.2
928  'user_agent' => 'WSSSoapClient',
929  'exceptions' => true,
930  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
931  'trace' => self::$MYSOAPOP_TRACE
932  );
933 
934  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
935  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
936 
937  $mainWS = new \ArrayObject();
938  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
939 
940  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'generarIdentificadorENI', self::$NAMESPACE_GDE2);
941  $respuesta = $clienteWS->generarIdentificadorENI($miSoapRQ);
942 
943  $vRespuesta = array();
944  if (is_object($respuesta))
945  {
946  $vRespuesta = $this->objectTree2array($respuesta);
947  }
948  return($vRespuesta);
949  }
950  catch (\Exception $e)
951  {
952  // Comprobamos si estamos ante excepcion MTOM
953  $mensaje = $e->getMessage();
954  $mensaje = trim(strtolower($mensaje));
955  switch ($mensaje)
956  {
957  case 'looks like we got no xml document' :
958  // Obtiene la respuesta
959  $response = $clienteWS->__getLastResponse();
960  $respuesta = $this->tratarMTOMEstandar($response);
961  return $respuesta;
962  break;
963 
964  default:
965  $this->aislarExcepcionGDE($e, $clienteWS);
966  break;
967  }
968  }
969  }//generarIdentificadorENI
970 
971 
977  public function generarToken($codApp, $vRefDoc)
978  {
979  //$this->setDebugMode(true);
980  try
981  {
982  $opcionesClienteWS = array (
983  'soap_version' => SOAP_1_1, //SOAP 1.2
984  'user_agent' => 'WSSSoapClient',
985  'exceptions' => true,
986  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
987  'trace' => self::$MYSOAPOP_TRACE
988  );
989 
990  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
991  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
992 
993  $composer = new ComposerGDE2();
994  $peticionWSRequest = $composer->__cde__generarToken_full(array('referenciaDocumento' => $vRefDoc), 'peticion', self::$NAMESPACE_GDE2);
995 
996  $obtenerDocumentoWSRequest = new \ArrayObject();
997  $obtenerDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
998  $obtenerDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
999 
1000  $miSoapRQ = new \SoapVar($obtenerDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'generarToken', self::$NAMESPACE_GDE2);
1001  $respuesta = $clienteWS->generarToken($miSoapRQ);
1002 
1003 
1004  $vRespuesta = array();
1005  if (is_object($respuesta))
1006  {
1007  $vRespuesta = $this->objectTree2array($respuesta);
1008  }
1009  return($vRespuesta);
1010  }
1011  catch (\Exception $e)
1012  {
1013  // Comprobamos si estamos ante excepcion MTOM
1014  $mensaje = $e->getMessage();
1015  $mensaje = trim(strtolower($mensaje));
1016  switch ($mensaje)
1017  {
1018  case 'looks like we got no xml document' :
1019  // Obtiene la respuesta
1020  $response = $clienteWS->__getLastResponse();
1021  $respuesta = $this->tratarMTOMEstandar($response);
1022  return $respuesta;
1023  break;
1024 
1025  default:
1026  $this->aislarExcepcionGDE($e, $clienteWS);
1027  break;
1028  }
1029  }
1030  }//generarToken
1031 
1032 
1046  public function insertarDocumentoENI($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetaENI=null, $vMetaPers=null, $vFirmas=null)
1047  {
1048  try
1049  {
1050  $this->__clienteOn(self::KEYCLIENTE_GDE2, true);
1051  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_GDE2];
1052 
1053  $composer = new ComposerGDE2();
1054  $peticionWSRequest = $composer->__cde__insertarDocumentoENI_full(array('documentoENI' => $docContentB64, 'nombre' => $nombreDoc,
1055  'path' => $pathDoc, 'tipoPersonalizado' => $tipo, 'metadatosENI' => $vMetaENI, 'coleccionMetadatosPersonalizados' => $vMetaPers, 'firmas' => $vFirmas), 'peticion', self::$NAMESPACE_GDE2);
1056 
1057  $mainWS = new \ArrayObject();
1058  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1059  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1060 
1061  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'insertarDocumentoENI', self::$NAMESPACE_GDE2);
1062  $respuesta = $clienteWS->insertarDocumentoENI($miSoapRQ);
1063 
1064 
1065  $vRespuesta = array();
1066  if (is_object($respuesta))
1067  {
1068  $vRespuesta = array
1069  (
1070  'referenciaDocumento' =>$respuesta->respuesta->referenciaDocumento,
1071  'nombre' => $respuesta->respuesta->nombre
1072  );
1073  }
1074  return($vRespuesta);
1075  }
1076  catch (\Exception $e)
1077  {
1078  // Comprobamos si estamos ante excepcion MTOM
1079  $mensaje = $e->getMessage();
1080  $mensaje = trim(strtolower($mensaje));
1081  switch ($mensaje)
1082  {
1083  case 'looks like we got no xml document' :
1084  // Obtiene la respuesta
1085  $response = $clienteWS->__getLastResponse();
1086  $respuesta = $this->tratarMTOMEstandar($response);
1087  return $respuesta;
1088  break;
1089 
1090  default:
1091  $this->aislarExcepcionGDE($e, $clienteWS);
1092  break;
1093  }
1094  }
1095  }//insertarDocumentoENI
1096 
1097 
1104  public function obtenerDocumentoENI($codApp, $refDoc)
1105  {
1106  //$this->setDebugMode(true);
1107  try
1108  {
1109  $opcionesClienteWS = array (
1110  'soap_version' => SOAP_1_1, //SOAP 1.2
1111  'user_agent' => 'WSSSoapClient',
1112  'exceptions' => true,
1113  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1114  'trace' => self::$MYSOAPOP_TRACE
1115  );
1116 
1117  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1118  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1119 
1120  $composer = new ComposerGDE2();
1121  $peticionWSRequest = $composer->__cde__obtenerDocumentoENI_full(
1122  array(
1123  'referenciaDocumento' => $refDoc
1124  ), 'peticion', self::$NAMESPACE_GDE2);
1125 
1126  $mainWS = new \ArrayObject();
1127  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1128  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1129 
1130  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'obtenerDocumentoENI', self::$NAMESPACE_GDE2);
1131  $respuesta = $clienteWS->obtenerDocumentoENI($miSoapRQ);
1132 
1133  $vRespuesta = array();
1134  if (is_object($respuesta))
1135  {
1136  $vRespuesta = $this->objectTree2array($respuesta);
1137  }
1138  return($vRespuesta);
1139  }
1140  catch (\Exception $e)
1141  {
1142  // Comprobamos si estamos ante excepcion MTOM
1143  $mensaje = $e->getMessage();
1144  $mensaje = trim(strtolower($mensaje));
1145  switch ($mensaje)
1146  {
1147  case 'looks like we got no xml document' :
1148  // Obtiene la respuesta
1149  $response = $clienteWS->__getLastResponse();
1150  $respuesta = $this->tratarMTOMEstandar($response);
1151  return $respuesta;
1152  break;
1153 
1154  default:
1155  $this->aislarExcepcionGDE($e, $clienteWS);
1156  break;
1157  }
1158  }
1159  }//obtenerDocumentoENI
1160 
1161 
1177  public function obtenerExpedienteENI($codApp, $refDoc, $vMetadatosExpedienteEni, $idCertificadoSafe = null, $idSesionSafe = null)
1178  {
1179  //$this->setDebugMode(true);
1180  try
1181  {
1182  $opcionesClienteWS = array (
1183  'soap_version' => SOAP_1_1, //SOAP 1.2
1184  'user_agent' => 'WSSSoapClient',
1185  'exceptions' => true,
1186  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1187  'trace' => self::$MYSOAPOP_TRACE
1188  );
1189 
1190  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1191  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1192 
1193  $composer = new ComposerGDE2();
1194  $peticionWSRequest = $composer->__cde__obtenerExpedienteENI_full(array('referenciaDocumento' => $refDoc, 'datosCertificado' => array('idCertificadoSafe' => $idCertificadoSafe, 'idSesionSafe' => $idSesionSafe), 'metadatosExpedienteEni' => $vMetadatosExpedienteEni), 'peticion', self::$NAMESPACE_GDE2);
1195 
1196  $mainWS = new \ArrayObject();
1197  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1198  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1199 
1200  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'obtenerExpedienteENI', self::$NAMESPACE_GDE2);
1201  $respuesta = $clienteWS->obtenerExpedienteENI($miSoapRQ);
1202 
1203  $vRespuesta = array();
1204  if (is_object($respuesta))
1205  {
1206  $vRespuesta = $this->objectTree2array($respuesta);
1207  }
1208  return($vRespuesta);
1209  }
1210  catch (\Exception $e)
1211  {
1212  // Comprobamos si estamos ante excepcion MTOM
1213  $mensaje = $e->getMessage();
1214  $mensaje = trim(strtolower($mensaje));
1215  switch ($mensaje)
1216  {
1217  case 'looks like we got no xml document' :
1218  // Obtiene la respuesta
1219  $response = $clienteWS->__getLastResponse();
1220  $respuesta = $this->tratarMTOMEstandar($response);
1221  return $respuesta;
1222  break;
1223 
1224  default:
1225  $this->aislarExcepcionGDE($e, $clienteWS);
1226  break;
1227  }
1228  }
1229  }//obtenerExpedienteENI
1230 
1231 
1240  public function obtenerExpedienteENIdeCarpeta($codApp, $path, $idCertificadoSafe = null, $idSesionSafe = null)
1241  {
1242  //$this->setDebugMode(true);
1243  try
1244  {
1245  $opcionesClienteWS = array (
1246  'soap_version' => SOAP_1_1, //SOAP 1.2
1247  'user_agent' => 'WSSSoapClient',
1248  'exceptions' => true,
1249  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1250  'trace' => self::$MYSOAPOP_TRACE
1251  );
1252 
1253  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1254  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1255 
1256 
1257  $composer = new ComposerGDE2();
1258  $vDataPeticion = array('path' => $path);
1259  if (!is_null($idCertificadoSafe) && !is_null($idSesionSafe)) {
1260  $vDataPeticion = array('path' => $path, 'datosCertificado' => array('idCertificadoSafe' => $idCertificadoSafe, 'idSesionSafe' => $idSesionSafe));
1261  }
1262  $peticionWSRequest = $composer->__cde__obtenerExpedienteENIdeCarpeta_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1263 
1264  $mainWS = new \ArrayObject();
1265  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1266  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1267 
1268  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'obtenerExpedienteENIdeCarpeta', self::$NAMESPACE_GDE2);
1269  $respuesta = $clienteWS->obtenerExpedienteENIdeCarpeta($miSoapRQ);
1270 
1271  $vRespuesta = array();
1272  if (is_object($respuesta))
1273  {
1274  $vRespuesta = $this->objectTree2array($respuesta);
1275  }
1276  return($vRespuesta);
1277  }
1278  catch (\Exception $e)
1279  {
1280  // Comprobamos si estamos ante excepcion MTOM
1281  $mensaje = $e->getMessage();
1282  $mensaje = trim(strtolower($mensaje));
1283  switch ($mensaje)
1284  {
1285  case 'looks like we got no xml document' :
1286  // Obtiene la respuesta
1287  $response = $clienteWS->__getLastResponse();
1288  $respuesta = $this->tratarMTOMEstandar($response);
1289  return $respuesta;
1290  break;
1291 
1292  default:
1293  $this->aislarExcepcionGDE($e, $clienteWS);
1294  break;
1295  }
1296  }
1297  }//obtenerExpedienteENIdeCarpeta
1298 
1299 
1300 
1301 
1302  /*****************************************************************************/
1303  /* NUEVOS METODOS */
1304  /*****************************************************************************/
1305 
1318  public function moverDocumento($codApp, $refDoc, $pathDestino)
1319  {
1320  //$this->setDebugMode(true);
1321  try
1322  {
1323  $opcionesClienteWS = array (
1324  'soap_version' => SOAP_1_1, //SOAP 1.2
1325  'user_agent' => 'WSSSoapClient',
1326  'exceptions' => true,
1327  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1328  'trace' => self::$MYSOAPOP_TRACE
1329  );
1330 
1331  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1332  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1333 
1334 
1335  $composer = new ComposerGDE2();
1336  $vDataPeticion = array('referenciaDocumento' => $refDoc, 'pathDestino' => $pathDestino);
1337  $peticionWSRequest = $composer->__cde__moverDocumento_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1338 
1339  $mainWS = new \ArrayObject();
1340  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1341  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1342 
1343  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'moverDocumento', self::$NAMESPACE_GDE2);
1344  $respuesta = $clienteWS->moverDocumento($miSoapRQ);
1345 
1346  $vRespuesta = array();
1347  if (is_object($respuesta))
1348  {
1349  $vRespuesta = $this->objectTree2array($respuesta);
1350  }
1351  return($vRespuesta);
1352  }
1353  catch (\Exception $e)
1354  {
1355  return $this->tratarInnerException($clienteWS, $e);
1356  }
1357  }//moverDocumento
1358 
1359 
1374  public function actualizarDocumento($codApp, $refDoc, $docContentB64, $vFirmas=null)
1375  {
1376  try
1377  {
1378  $this->__clienteOn(self::KEYCLIENTE_GDE2, true);
1379  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_GDE2];
1380 
1381  $composer = new ComposerGDE2();
1382  $peticionWSRequest = $composer->__cde__actualizarDocumento_full(
1383  array(
1384  'referenciaDocumento' => $refDoc,
1385  'contenido' => $docContentB64,
1386  'firmas' => $vFirmas
1387  ), 'peticion', self::$NAMESPACE_GDE2);
1388 
1389  $mainWS = new \ArrayObject();
1390  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1391  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1392 
1393  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'actualizarDocumento', self::$NAMESPACE_GDE2);
1394  $respuesta = $clienteWS->actualizarDocumento($miSoapRQ);
1395 
1396  $vRespuesta = array();
1397  if (is_object($respuesta))
1398  {
1399  $vRespuesta = $this->objectTree2array($respuesta);
1400  }
1401  return($vRespuesta);
1402  }
1403  catch (\Exception $e)
1404  {
1405  return $this->tratarInnerException($clienteWS, $e);
1406  }
1407  }//actualizarDocumento
1408 
1409 
1419  public function obtenerListaVersionesDocumento($codApp, $refDoc){
1420  //$this->setDebugMode(true);
1421  try
1422  {
1423  $opcionesClienteWS = array (
1424  'soap_version' => SOAP_1_1, //SOAP 1.2
1425  'user_agent' => 'WSSSoapClient',
1426  'exceptions' => true,
1427  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1428  'trace' => self::$MYSOAPOP_TRACE
1429  );
1430 
1431  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1432  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1433 
1434 
1435  $composer = new ComposerGDE2();
1436  $vDataPeticion = array('referenciaDocumento' => $refDoc);
1437  $peticionWSRequest = $composer->__cde__obtenerListaVersionesDocumento_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1438 
1439  $WSRequest = new \ArrayObject();
1440  $WSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1441  $WSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1442 
1443  $miSoapRQ = new \SoapVar($WSRequest, SOAP_ENC_OBJECT,null,null,'obtenerListaVersionesDocumento', self::$NAMESPACE_GDE2);
1444  $respuesta = $clienteWS->obtenerListaVersionesDocumento($miSoapRQ);
1445 
1446  $vRespuesta = array();
1447  if (is_object($respuesta))
1448  {
1449  $vRespuesta = $this->objectTree2array($respuesta);
1450  }
1451  return($vRespuesta);
1452  }
1453  catch (\Exception $e)
1454  {
1455  return $this->tratarInnerException($clienteWS, $e);
1456  }
1457  }//obtenerListaVersionesDocumento
1458 
1459 
1473  public function restaurarVersionDocumento($codApp, $refDoc, $version, $parcial){
1474  //$this->setDebugMode(true);
1475  try
1476  {
1477  $opcionesClienteWS = array (
1478  'soap_version' => SOAP_1_1, //SOAP 1.2
1479  'user_agent' => 'WSSSoapClient',
1480  'exceptions' => true,
1481  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1482  'trace' => self::$MYSOAPOP_TRACE
1483  );
1484 
1485  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1486  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1487 
1488 
1489  $composer = new ComposerGDE2();
1490  $vDataPeticion = array('referenciaDocumento' => $refDoc, 'version' => $version, 'parcial' => $parcial);
1491  $peticionWSRequest = $composer->__cde__restaurarVersionDocumento_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1492 
1493  $obtenerDocumentoWSRequest = new \ArrayObject();
1494  $obtenerDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1495  $obtenerDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1496 
1497  $miSoapRQ = new \SoapVar($obtenerDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'restaurarVersionDocumento', self::$NAMESPACE_GDE2);
1498  $respuesta = $clienteWS->restaurarVersionDocumento($miSoapRQ);
1499 
1500  $vRespuesta = array();
1501  if (is_object($respuesta))
1502  {
1503  $vRespuesta = $this->objectTree2array($respuesta);
1504  }
1505  return($vRespuesta);
1506  }
1507  catch (\Exception $e)
1508  {
1509  return $this->tratarInnerException($clienteWS, $e);
1510  }
1511  }//restaurarVersionDocumento
1512 
1513 
1524  public function obtenerPathDocumento($codApp, $refDoc){
1525  //$this->setDebugMode(true);
1526  try
1527  {
1528  $opcionesClienteWS = array (
1529  'soap_version' => SOAP_1_1, //SOAP 1.2
1530  'user_agent' => 'WSSSoapClient',
1531  'exceptions' => true,
1532  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1533  'trace' => self::$MYSOAPOP_TRACE
1534  );
1535 
1536  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1537  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1538 
1539 
1540  $composer = new ComposerGDE2();
1541  $vDataPeticion = array('referenciaDocumento' => $refDoc);
1542  $peticionWSRequest = $composer->__cde__obtenerPathDocumento_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1543 
1544  $mainWS = new \ArrayObject();
1545  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1546  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1547 
1548  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'obtenerPathDocumento', self::$NAMESPACE_GDE2);
1549  $respuesta = $clienteWS->obtenerPathDocumento($miSoapRQ);
1550 
1551  $vRespuesta = array();
1552  if (is_object($respuesta))
1553  {
1554  $vRespuesta = $this->objectTree2array($respuesta);
1555  }
1556  return($vRespuesta);
1557  }
1558  catch (\Exception $e)
1559  {
1560  return $this->tratarInnerException($clienteWS, $e);
1561  }
1562  }//obtenerPathDocumento
1563 
1564 
1574  public function eliminarCarpetaRecursiva($codApp, $path)
1575  {
1576  //$this->setDebugMode(true);
1577  try
1578  {
1579  $opcionesClienteWS = array (
1580  'soap_version' => SOAP_1_1, //SOAP 1.2
1581  'user_agent' => 'WSSSoapClient',
1582  'exceptions' => true,
1583  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1584  'trace' => self::$MYSOAPOP_TRACE
1585  );
1586 
1587  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1588  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1589 
1590 
1591  $composer = new ComposerGDE2();
1592  $peticionWSRequest = $composer->__cde__eliminarCarpetaRecursiva_full(array('path' => $path), 'peticion', self::$NAMESPACE_GDE2);
1593 
1594  $obtenerDocumentoWSRequest = new \ArrayObject();
1595  $obtenerDocumentoWSRequest->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1596  $obtenerDocumentoWSRequest->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1597 
1598  $miSoapRQ = new \SoapVar($obtenerDocumentoWSRequest, SOAP_ENC_OBJECT,null,null,'eliminarCarpetaRecursiva', self::$NAMESPACE_GDE2);
1599  $respuesta = $clienteWS->eliminarCarpetaRecursiva($miSoapRQ);
1600 
1601  $vRespuesta = array();
1602  if (is_object($respuesta))
1603  {
1604  $vRespuesta = $this->objectTree2array($respuesta);
1605  }
1606  return($vRespuesta);
1607  }
1608  catch (\Exception $e)
1609  {
1610  return $this->tratarInnerException($clienteWS, $e);
1611  }
1612  }//eliminarCarpetaRecursiva
1613 
1614 
1625  public function moverCarpeta($codApp, $pathOrigen, $pathDestino){
1626  //$this->setDebugMode(true);
1627  try
1628  {
1629  $opcionesClienteWS = array (
1630  'soap_version' => SOAP_1_1, //SOAP 1.2
1631  'user_agent' => 'WSSSoapClient',
1632  'exceptions' => true,
1633  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1634  'trace' => self::$MYSOAPOP_TRACE
1635  );
1636 
1637  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1638  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1639 
1640 
1641  $composer = new ComposerGDE2();
1642  $vDataPeticion = array('pathOrigen' => $pathOrigen, 'pathDestino' => $pathDestino);
1643  $peticionWSRequest = $composer->__cde__moverCarpeta_full($vDataPeticion, 'peticion', self::$NAMESPACE_GDE2);
1644 
1645  $mainWS = new \ArrayObject();
1646  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1647  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1648 
1649  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'moverCarpeta', self::$NAMESPACE_GDE2);
1650  $respuesta = $clienteWS->moverCarpeta($miSoapRQ);
1651 
1652  $vRespuesta = array();
1653  if (is_object($respuesta))
1654  {
1655  $vRespuesta = $this->objectTree2array($respuesta);
1656  }
1657  return($vRespuesta);
1658  }
1659  catch (\Exception $e)
1660  {
1661  return $this->tratarInnerException($clienteWS, $e);
1662  }
1663  }//moverCarpeta
1664 
1665 
1677  public function obtenerVersionDocumento($codApp, $refDoc, $parcial, $version)
1678  {
1679  //$this->setDebugMode(true);
1680  try
1681  {
1682  $opcionesClienteWS = array (
1683  'soap_version' => SOAP_1_1, //SOAP 1.2
1684  'user_agent' => 'WSSSoapClient',
1685  'exceptions' => true,
1686  'cache_wsdl' => self::$MYSOAPOP_WSDL_CACHE,
1687  'trace' => self::$MYSOAPOP_TRACE
1688  );
1689 
1690  $this->__clienteOn(self::KEYCLIENTE_GDE2, true, $opcionesClienteWS);
1691  $clienteWS = $this->__getClient(self::KEYCLIENTE_GDE2);
1692 
1693  $composer = new ComposerGDE2();
1694  $peticionWSRequest = $composer->__cde__obtenerVersionDocumento_full(
1695  array(
1696  'referenciaDocumento' => $refDoc,
1697  'parcial' => $parcial,
1698  'version' => $version
1699  ), 'peticion', self::$NAMESPACE_GDE2);
1700 
1701  $mainWS = new \ArrayObject();
1702  $mainWS->append(new \SoapVar($codApp, XSD_STRING, null, null,'codigoAplicacion', self::$NAMESPACE_GDE2));
1703  $mainWS->append(new \SoapVar($peticionWSRequest, SOAP_ENC_OBJECT,null,null,'peticion', self::$NAMESPACE_GDE2));
1704 
1705  $miSoapRQ = new \SoapVar($mainWS, SOAP_ENC_OBJECT,null,null,'obtenerVersionDocumento', self::$NAMESPACE_GDE2);
1706  $respuesta = $clienteWS->obtenerVersionDocumento($miSoapRQ);
1707 
1708  $vRespuesta = array();
1709  if (is_object($respuesta))
1710  {
1711  $vRespuesta = $this->objectTree2array($respuesta);
1712  }
1713  return($vRespuesta);
1714  }
1715  catch (\Exception $e)
1716  {
1717  return $this->tratarInnerException($clienteWS, $e);
1718  }
1719  }//obtenerVersionDocumento
1720 
1721 
1722 
1723  /*****************************************************************************/
1724  /* AUXILIARES DE FRONT END */
1725  /*****************************************************************************/
1726 
1727 
1737  public function front_obtenerDocumentoAPartirDeToken($esProduccion, $token){
1738  // Compone la URL de la peticion
1739  $urlPeticion = URL_FRONT_DESARROLLO;
1740  if ($esProduccion) {
1741  $urlPeticion = URL_FRONT_PRODUCCION;
1742  }
1743 
1744  return $urlPeticion . 'getToken?token=' . $token;
1745  }//front_obtenerDocumentoAPartirDeToken
1746 
1747 
1759  public function front_obtenerIdentificadorGDE($esProduccion, $codApp, $refDoc){
1760  // Compone la URL de la peticion
1761  $urlPeticion = URL_FRONT_DESARROLLO;
1762  if ($esProduccion) {
1763  $urlPeticion = URL_FRONT_PRODUCCION;
1764  }
1765 
1766  return $urlPeticion . 'getId?codigoAplicacion=' . $codApp . '&ref=' . $refDoc;
1767  }//front_obtenerIdentificadorGDE
1768 
1769 
1770 
1771 
1772  /*****************************************************************************/
1773  /* NOMENCLATURA ANTIGUA - OBSOLETA */
1774  /*****************************************************************************/
1775 
1776 
1799  public function insertarDocumentoGDE2($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo = null, $vMetadatosENI = null, $vMetadatosPersonalizados=null, $vFirmas=null)
1800  {
1801  return $this->insertarDocumento($codApp, $docContentB64, $nombreDoc, $pathDoc, $tipo, $vMetadatosENI, $vMetadatosPersonalizados, $vFirmas);
1802  }//insertarDocumentoGDE2
1803 
1804 
1805 
1817  public function obtenerDocumentoGDE2($codApp, $refDoc, $parcial='1')
1818  {
1819  return $this->obtenerDocumento($codApp, $refDoc, $parcial);
1820  }//obtenerDocumentoGDE2
1821 
1822 
1833  public function eliminarDocumentoGDE2($codApp, $refDoc)
1834  {
1835  return $this->eliminarDocumento($codApp, $refDoc);
1836  }//eliminarDocumentoGDE2
1837 
1838 
1839 
1848  public function asociarFirmasGDE2($codApp, $refDoc, $vFirmas)
1849  {
1850  return $this->asociarFirmas($codApp, $refDoc, $vFirmas);
1851  }//asociarFirmasGDE2
1852 
1853 
1854 
1872  public function buscarDocCriterioGDE2($codApp, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
1873  {
1874  return $this->buscarDocCriterio($codApp, $filtroPath, $buscarInTree, $operacion, $coleccionCriterios);
1875  }//buscarDocCriterioGDE2
1876 
1877 
1895  public function buscarDocCriterioPaginadoGDE2($codApp, $registrosPagina, $pagina, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
1896  {
1897  return $this->buscarDocCriterioPaginado($codApp, $registrosPagina, $pagina, $filtroPath, $buscarInTree, $operacion, $coleccionCriterios);
1898  }//buscarDocCriterioPaginadoGDE2
1899 
1900 
1901 
1911  public function crearCarpetaGDE2($codApp, $path, $tipo=null, $metadatosExpedienteEni=null, $coleccionMetadatosPersonalizados=null)
1912  {
1913  return $this->crearCarpeta($codApp, $path, $tipo, $metadatosExpedienteEni, $coleccionMetadatosPersonalizados);
1914  }//crearCarpetaGDE2
1915 
1916 
1924  public function eliminarCarpetaGDE2($codApp, $path)
1925  {
1926  return $this->eliminarCarpeta($codApp, $path);
1927  }//eliminarCarpetaGDE2
1928 
1929 
1930 
1939  public function empaquetarDocumentoENIGDE2($codApp, $contenido, $vMetadatosEni, $vFirmas)
1940  {
1941  return $this->empaquetarDocumentoENI($codApp, $contenido, $vMetadatosEni, $vFirmas);
1942  }//empaquetarDocumentoENIGDE2
1943 
1944 
1953  public function establecerMetadatoCarpetasPersonalizadosGDE2($codApp, $path, $vColMetadatosPers)
1954  {
1955  return $this->establecerMetadatoCarpetasPersonalizados($codApp, $path, $vColMetadatosPers);
1956  }//establecerMetadatoCarpetasPersonalizadosGDE2
1957 
1965  public function establecerMetadatosCarpetaExpedienteENIGDE2($codApp, $path, $vMetadatosExpedienteEni)
1966  {
1967  return $this->establecerMetadatosCarpetaExpedienteENI($codApp, $path, $vMetadatosExpedienteEni);
1968  }//establecerMetadatosCarpetaExpedienteENIGDE2
1969 
1970 
1981  public function establecerMetadatosENIGDE2($codApp, $refDoc, $vMetadatosEni)
1982  {
1983  return $this->establecerMetadatosENI($codApp, $refDoc, $vMetadatosEni);
1984  }//establecerMetadatosENIGDE2
1985 
1986 
1994  public function establecerMetadatosPersonalizadosGDE2($codApp, $refDoc, $coleccionMetadatosPersonalizados)
1995  {
1996  return $this->establecerMetadatosPersonalizados($codApp, $refDoc, $coleccionMetadatosPersonalizados);
1997  }//establecerMetadatosPersonalizadosGDE2
1998 
1999 
2005  public function generarIdentificadorENIGDE2($codApp)
2006  {
2007  return $this->generarIdentificadorENI($codApp);
2008  }//generarIdentificadorENIGDE2
2009 
2010 
2017  public function generarTokenGDE2($codApp, $vRefDoc)
2018  {
2019  return $this->generarToken($codApp, $vRefDoc);
2020  }//generarTokenGDE2
2021 
2022 
2037  public function insertarDocumentoENIGDE2($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetaENI=null, $vMetaPers=null, $vFirmas=null)
2038  {
2039  return $this->insertarDocumentoENI($codApp, $docContentB64, $nombreDoc, $pathDoc, $tipo, $vMetaENI, $vMetaPers, $vFirmas);
2040  }//insertarDocumentoENIGDE2
2041 
2042 
2050  public function obtenerDocumentoENIGDE2($codApp, $refDoc)
2051  {
2052  return $this->obtenerDocumentoENI($codApp, $refDoc);
2053  }//obtenerDocumentoENIGDE2
2054 
2055 
2072  public function obtenerExpedienteENIGDE2($codApp, $refDoc, $vMetadatosExpedienteEni, $idCertificadoSafe = null, $idSesionSafe = null)
2073  {
2074  return $this->obtenerExpedienteENI($codApp, $refDoc, $vMetadatosExpedienteEni, $idCertificadoSafe, $idSesionSafe);
2075  }//obtenerExpedienteENIGDE2
2076 
2086  public function obtenerExpedienteENIdeCarpetaGDE2($codApp, $path, $idCertificadoSafe = null, $idSesionSafe = null)
2087  {
2088  return $this->obtenerExpedienteENIdeCarpeta($codApp, $path, $idCertificadoSafe, $idSesionSafe);
2089  }//obtenerExpedienteENIdeCarpetaGDE2
2090 
2091 
2092 
2093 
2094 
2095 
2102  private function tratarInnerException($clienteWS, $e)
2103  {
2104  // Comprobamos si estamos ante excepcion MTOM
2105  $mensaje = $e->getMessage();
2106  $mensaje = trim(strtolower($mensaje));
2107  switch ($mensaje)
2108  {
2109  case 'looks like we got no xml document' :
2110  // Obtiene la respuesta
2111  $response = $clienteWS->__getLastResponse();
2112  $respuesta = $this->tratarMTOMEstandar($response);
2113  return $respuesta;
2114  break;
2115 
2116  default:
2117  $this->aislarExcepcionGDE($e, $clienteWS);
2118  break;
2119  }
2120  }//tratarInnerException
2121 
2122 
2130  private function aislarExcepcionGDE($e, $clienteWS)
2131  {
2132  $tratado = false;
2133 
2134 
2135  // Si es un SoapFault y su codigo es soap::Server, asumimos que se trata de una excepcion GDE2
2136  if ($e instanceof \SoapFault) {
2137  if ($e->faultcode == 'soap:Server') {
2138 
2139  // Determina si es una excepcion detallada o no
2140  if (isset($e->detail)) {
2141  // Excepcion GDE2 detallada (Debe contener un objeto ExcepcionWS en su "detail")
2142  throw new GDE2Exception(GDE2Exception::getCodeFromFaultCode($e->faultstring), $e->faultstring, $e->detail->ExcepcionWS);
2143  } else {
2144  // Excepcion GDE2 generica (No contiene un objeto ExcepcionWS y no informa del tipo de excepcion exacto)
2145  throw new GDE2Exception(GDE2Exception::CODE_Desconocido, $e->getMessage());
2146  }
2147  }
2148  }
2149 
2150  // Si aun no se ha tratado la excepcion, la trata como una excepcion normal
2151  if (!$tratado) {
2152  $this->tratarExcepcionEstandar($e, $clienteWS);
2153  }
2154  }//aislarExcepcionGDE
2155 
2156 }
2157 
2158 
2159 
2160 
2167 class GDE2Exception extends \Exception
2168 {
2169 
2173  const CODE_Desconocido = 0;
2174  const CODE_UsuarioNoAutorizado = 1;
2175  const CODE_AplicacionNoExistente = 2;
2176  const CODE_GestorDocumental = 3;
2177  const CODE_LimiteRegistrosSobrepasado = 4;
2178  const CODE_IdentificadorENINoValido = 5;
2179  const CODE_EniConverterter = 6;
2180  const CODE_DocumentoNoInteroperable = 7;
2181  const CODE_TokenYaUtilizado = 8;
2182  const CODE_TokenCaducado = 9;
2183  const CODE_TokenIncorrecto = 10;
2184  const CODE_ExpedienteNoInteroperable = 11;
2185  const CODE_XMLExpedienteNoValido = 12;
2186  const CODE_DocumentoVacio = 13;
2187  const CODE_DocumentoNoExistente = 14;
2188  const CODE_PathAutoNoDisponible = 15;
2189 
2193  const MSG_UsuarioNoAutorizado = 'GDE_UsuarioNoAutorizadoException';
2194  const MSG_AplicacionNoExistente = 'GDE_AplicacionNoExistenteException';
2195  const MSG_GestorDocumental = 'GDE_GestorDocumentalException';
2196  const MSG_LimiteRegistrosSobrepasado = 'GDE_LimiteRegistrosSobrepasadoException';
2197  const MSG_IdentificadorENINoValido = 'GDE_IdentificadorENINoValidoException';
2198  const MSG_EniConverterter = 'GDE_EniConverterterException';
2199  const MSG_DocumentoNoInteroperable = 'GDE_DocumentoNoInteroperableException';
2200  const MSG_TokenYaUtilizado = 'GDE_TokenYaUtilizadoException';
2201  const MSG_TokenCaducado = 'GDE_TokenCaducadoException';
2202  const MSG_TokenIncorrecto = 'GDE_TokenIncorrectoException';
2203  const MSG_ExpedienteNoInteroperable = 'GDE_ExpedienteNoInteroperableException';
2204  const MSG_XMLExpedienteNoValido = 'GDE_XMLExpedienteNoValidoException';
2205  const MSG_DocumentoVacio = 'GDE_DocumentoVacioException';
2206  const MSG_DocumentoNoExistente = 'GDE_DocumentoNoExistenteException';
2207  const MSG_PathAutoNoDisponible = 'GDE_PathAutoNoDisponibleException';
2208 
2209 
2213  private $exceptionWS = null;
2214 
2215 
2221  public function getExceptionWS() {
2222  return $this->exceptionWS;
2223  }
2224 
2225 
2226  public function __construct($code, $message, $exceptionWS = null) {
2227  // asegúrese de que todo está asignado apropiadamente
2228  parent::__construct($message, $code);
2229 
2230  $this->exceptionWS = $exceptionWS;
2231  }
2232 
2233  public function __toString() {
2234  return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
2235  }
2236 
2237 
2243  public function getCodeAsString() {
2244  switch ($this->getCode()) {
2245  case GDE2Exception::CODE_UsuarioNoAutorizado:
2246  return "UsuarioNoAutorizado";
2247  break;
2248 
2249  case GDE2Exception::CODE_AplicacionNoExistente:
2250  return "AplicacionNoExistente";
2251  break;
2252 
2253  case GDE2Exception::CODE_GestorDocumental:
2254  return "GestorDocumental";
2255  break;
2256 
2257  case GDE2Exception::CODE_LimiteRegistrosSobrepasado:
2258  return "LimiteRegistrosSobrepasado";
2259  break;
2260 
2261  case GDE2Exception::CODE_IdentificadorENINoValido:
2262  return "IdentificadorENINoValido";
2263  break;
2264 
2265  case GDE2Exception::CODE_EniConverterter:
2266  return "EniConverterter";
2267  break;
2268 
2269  case GDE2Exception::CODE_DocumentoNoInteroperable:
2270  return "DocumentoNoInteroperable";
2271  break;
2272 
2273  case GDE2Exception::CODE_TokenYaUtilizado:
2274  return "TokenYaUtilizado";
2275  break;
2276 
2277  case GDE2Exception::CODE_TokenCaducado:
2278  return "TokenCaducado";
2279  break;
2280 
2281  case GDE2Exception::CODE_TokenIncorrecto:
2282  return "TokenIncorrecto";
2283  break;
2284 
2285  case GDE2Exception::CODE_ExpedienteNoInteroperable:
2286  return "ExpedienteNoInteroperable";
2287  break;
2288 
2289  case GDE2Exception::CODE_XMLExpedienteNoValido:
2290  return "XMLExpedienteNoValido";
2291  break;
2292 
2293  case GDE2Exception::CODE_DocumentoVacio:
2294  return "DocumentoVacio";
2295  break;
2296 
2297  case GDE2Exception::CODE_DocumentoNoExistente:
2298  return "DocumentoNoExistente";
2299  break;
2300 
2301  case GDE2Exception::CODE_PathAutoNoDisponible:
2302  return "PathAutoNoDisponible";
2303  break;
2304 
2306  default:
2307  return "Desconocido";
2308  break;
2309  }
2310  }
2311 
2312 
2319  public static function getCodeFromFaultCode($faultcode) {
2320  if ($faultcode == GDE2Exception::MSG_UsuarioNoAutorizado) {
2321  return GDE2Exception::CODE_UsuarioNoAutorizado;
2322  }
2323  if ($faultcode == GDE2Exception::MSG_AplicacionNoExistente) {
2324  return GDE2Exception::CODE_AplicacionNoExistente;
2325  }
2326  if ($faultcode == GDE2Exception::MSG_GestorDocumental) {
2327  return GDE2Exception::CODE_GestorDocumental;
2328  }
2329  if ($faultcode == GDE2Exception::MSG_LimiteRegistrosSobrepasado) {
2330  return GDE2Exception::CODE_LimiteRegistrosSobrepasado;
2331  }
2332  if ($faultcode == GDE2Exception::MSG_IdentificadorENINoValido) {
2333  return GDE2Exception::CODE_IdentificadorENINoValido;
2334  }
2335  if ($faultcode == GDE2Exception::MSG_EniConverterter) {
2336  return GDE2Exception::CODE_EniConverterter;
2337  }
2338  if ($faultcode == GDE2Exception::MSG_DocumentoNoInteroperable) {
2339  return GDE2Exception::CODE_DocumentoNoInteroperable;
2340  }
2341  if ($faultcode == GDE2Exception::MSG_TokenYaUtilizado) {
2342  return GDE2Exception::CODE_TokenYaUtilizado;
2343  }
2344  if ($faultcode == GDE2Exception::MSG_TokenCaducado) {
2345  return GDE2Exception::CODE_TokenCaducado;
2346  }
2347  if ($faultcode == GDE2Exception::MSG_TokenIncorrecto) {
2348  return GDE2Exception::CODE_TokenIncorrecto;
2349  }
2350  if ($faultcode == GDE2Exception::MSG_ExpedienteNoInteroperable) {
2351  return GDE2Exception::CODE_ExpedienteNoInteroperable;
2352  }
2353  if ($faultcode == GDE2Exception::MSG_XMLExpedienteNoValido) {
2354  return GDE2Exception::CODE_XMLExpedienteNoValido;
2355  }
2356  if ($faultcode == GDE2Exception::MSG_DocumentoVacio) {
2357  return GDE2Exception::CODE_DocumentoVacio;
2358  }
2359  if ($faultcode == GDE2Exception::MSG_DocumentoNoExistente) {
2360  return GDE2Exception::CODE_DocumentoNoExistente;
2361  }
2362  if ($faultcode == GDE2Exception::MSG_PathAutoNoDisponible) {
2363  return GDE2Exception::CODE_PathAutoNoDisponible;
2364  }
2365 
2367  }
2368 
2369 
2370 }
2371 
2372 
2373 ?>
moverDocumento($codApp, $refDoc, $pathDestino)
obtenerDocumentoENIGDE2($codApp, $refDoc)
generarTokenGDE2($codApp, $vRefDoc)
obtenerExpedienteENIGDE2($codApp, $refDoc, $vMetadatosExpedienteEni, $idCertificadoSafe=null, $idSesionSafe=null)
eliminarCarpetaRecursiva($codApp, $path)
eliminarCarpetaGDE2($codApp, $path)
establecerMetadatoCarpetasPersonalizadosGDE2($codApp, $path, $vColMetadatosPers)
tratarMTOMEstandar($response, $itemToReturn=null)
obtenerDocumento($codApp, $refDoc, $parcial='1')
establecerMetadatosPersonalizados($codApp, $refDoc, $coleccionMetadatosPersonalizados)
buscarDocCriterioPaginadoGDE2($codApp, $registrosPagina, $pagina, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
establecerMetadatosCarpetaExpedienteENI($codApp, $path, $vMetadatosExpedienteEni)
empaquetarDocumentoENI($codApp, $contenido, $vMetadatosEni, $vFirmas)
eliminarCarpeta($codApp, $path)
obtenerExpedienteENI($codApp, $refDoc, $vMetadatosExpedienteEni, $idCertificadoSafe=null, $idSesionSafe=null)
obtenerExpedienteENIdeCarpeta($codApp, $path, $idCertificadoSafe=null, $idSesionSafe=null)
insertarDocumentoENIGDE2($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetaENI=null, $vMetaPers=null, $vFirmas=null)
obtenerListaVersionesDocumento($codApp, $refDoc)
asociarFirmasGDE2($codApp, $refDoc, $vFirmas)
buscarDocCriterioGDE2($codApp, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
crearCarpetaGDE2($codApp, $path, $tipo=null, $metadatosExpedienteEni=null, $coleccionMetadatosPersonalizados=null)
actualizarDocumento($codApp, $refDoc, $docContentB64, $vFirmas=null)
buscarDocCriterioPaginado($codApp, $registrosPagina, $pagina, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
eliminarDocumentoGDE2($codApp, $refDoc)
obtenerDocumentoGDE2($codApp, $refDoc, $parcial='1')
moverCarpeta($codApp, $pathOrigen, $pathDestino)
establecerMetadatosCarpetaExpedienteENIGDE2($codApp, $path, $vMetadatosExpedienteEni)
restaurarVersionDocumento($codApp, $refDoc, $version, $parcial)
insertarDocumentoGDE2($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetadatosENI=null, $vMetadatosPersonalizados=null, $vFirmas=null)
insertarDocumentoENI($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetaENI=null, $vMetaPers=null, $vFirmas=null)
establecerMetadatosENI($codApp, $refDoc, $vMetadatosEni)
eliminarDocumento($codApp, $refDoc)
establecerMetadatosPersonalizadosGDE2($codApp, $refDoc, $coleccionMetadatosPersonalizados)
crearCarpeta($codApp, $path, $tipo=null, $metadatosExpedienteEni=null, $coleccionMetadatosPersonalizados=null)
insertarDocumento($codApp, $docContentB64, $nombreDoc, $pathDoc=null, $tipo=null, $vMetadatosENI=null, $vMetadatosPersonalizados=null, $vFirmas=null)
asociarFirmas($codApp, $refDoc, $vFirmas)
front_obtenerIdentificadorGDE($esProduccion, $codApp, $refDoc)
establecerMetadatosENIGDE2($codApp, $refDoc, $vMetadatosEni)
obtenerVersionDocumento($codApp, $refDoc, $parcial, $version)
obtenerExpedienteENIdeCarpetaGDE2($codApp, $path, $idCertificadoSafe=null, $idSesionSafe=null)
__clienteOn($tipo, $trazabilidadPai=true, $opcionesClienteWS=null)
buscarDocCriterio($codApp, $filtroPath=null, $buscarInTree=null, $operacion=null, $coleccionCriterios=null)
obtenerDocumentoENI($codApp, $refDoc)
generarToken($codApp, $vRefDoc)
front_obtenerDocumentoAPartirDeToken($esProduccion, $token)
obtenerPathDocumento($codApp, $refDoc)
static getCodeFromFaultCode($faultcode)
empaquetarDocumentoENIGDE2($codApp, $contenido, $vMetadatosEni, $vFirmas)
establecerMetadatoCarpetasPersonalizados($codApp, $path, $vColMetadatosPers)