10 const unbounded =
'unbounded';
18 private static $NAMESPACE_ESP =
'http://intermediacion.redsara.es/scsp/esquemas/datosespecificos';
19 private static $NAMESPACE_PET =
'http://intermediacion.redsara.es/scsp/esquemas/V3/peticion';
20 private static $NAMESPACE_SR =
'http://intermediacion.redsara.es/scsp/esquemas/V3/solicitudRespuesta';
26 private $nifEmisor = null;
32 private $nombreEmisor = null;
38 private $codProcedimiento = null;
44 private $nombreProcedimiento = null;
50 private $nombreCompletoFuncionario = null;
56 private $nifFuncionario = null;
62 private $tipoDocumentacion = null;
68 private $documentacion = null;
74 private $nombreCompleto = null;
80 private $nombre = null;
86 private $apellido1 = null;
92 private $apellido2 = null;
98 private $identificadorSolicitante = null;
104 private $nombreSolicitante = null;
110 private $unidadTramitadora = null;
116 private $finalidad = null;
122 private $consentimiento = null;
128 private $idExpediente = null;
134 private $oEspecifico = null;
145 $this->nifEmisor = $nif;
146 $this->nombreEmisor = $nombre;
157 $this->codProcedimiento = $codigo;
158 $this->nombreProcedimiento = $nombre;
169 $this->nombreCompletoFuncionario = $nombreCompleto;
170 $this->nifFuncionario = $nif;
184 public function setTitular($tipoDocumentacion, $documentacion, $nombreCompleto = null, $nombre = null, $apellido1 = null, $apellido2 = null) {
185 $this->tipoDocumentacion = $tipoDocumentacion;
186 $this->documentacion = $documentacion;
187 $this->nombreCompleto = $nombreCompleto;
188 $this->nombre = $nombre;
189 $this->apellido1 = $apellido1;
190 $this->apellido2 = $apellido2;
204 public function setSolicitante($identificadorSolicitante, $nombreSolicitante, $consentimiento, $finalidad, $unidadTramitadora = null, $idExpediente = null) {
205 $this->identificadorSolicitante = $identificadorSolicitante;
206 $this->nombreSolicitante = $nombreSolicitante;
207 $this->consentimiento = $consentimiento;
208 $this->finalidad = $finalidad;
209 $this->unidadTramitadora = $unidadTramitadora;
210 $this->idExpediente = $idExpediente;
221 $this->oEspecifico = $oEspecifico;
233 $oClon->setEmisor($this->nifEmisor, $this->nombreEmisor);
234 $oClon->setProcedimiento($this->codProcedimiento, $this->nombreProcedimiento);
235 $oClon->setFuncionario($this->nombreCompletoFuncionario, $this->nifFuncionario);
236 $oClon->setTitular($this->tipoDocumentacion, $this->documentacion, $this->nombreCompleto, $this->nombre, $this->apellido1, $this->apellido2);
237 $oClon->setSolicitante($this->identificadorSolicitante, $this->nombreSolicitante, $this->consentimiento, $this->finalidad, $this->unidadTramitadora, $this->idExpediente);
253 public function toSoap($IdPeticion, $CodigoCertificado, $numParcial = null)
255 $IdSolicitud = $IdPeticion;
256 if (!is_null($numParcial)) {
257 $IdSolicitud = $IdPeticion .
'_' . $numParcial;
267 $EmisorWSRequest->append(
new SoapVar($this->nifEmisor, XSD_STRING, null, null,
'NifEmisor', self::$NAMESPACE_PET));
268 $EmisorWSRequest->append(
new SoapVar($this->nombreEmisor, XSD_STRING, null, null,
'NombreEmisor', self::$NAMESPACE_PET));
272 $ProcedimientoWSRequest->append(
new SoapVar($this->codProcedimiento, XSD_STRING, null, null,
'CodProcedimiento', self::$NAMESPACE_PET));
273 $ProcedimientoWSRequest->append(
new SoapVar($this->nombreProcedimiento, XSD_STRING, null, null,
'NombreProcedimiento', self::$NAMESPACE_PET));
277 $FuncionarioWSRequest->append(
new SoapVar($this->nombreCompletoFuncionario, XSD_STRING, null, null,
'NombreCompletoFuncionario', self::$NAMESPACE_PET));
278 $FuncionarioWSRequest->append(
new SoapVar($this->nifFuncionario, XSD_STRING, null, null,
'NifFuncionario', self::$NAMESPACE_PET));
282 $SolicitanteWSRequest->append(
new SoapVar($this->identificadorSolicitante, XSD_STRING, null, null,
'IdentificadorSolicitante', self::$NAMESPACE_PET));
283 $SolicitanteWSRequest->append(
new SoapVar($this->nombreSolicitante, XSD_STRING, null, null,
'NombreSolicitante', self::$NAMESPACE_PET));
284 if (!is_null($this->unidadTramitadora)) {
285 $SolicitanteWSRequest->append(
new SoapVar($this->unidadTramitadora, XSD_STRING, null, null,
'UnidadTramitadora', self::$NAMESPACE_PET));
287 $SolicitanteWSRequest->append(
new SoapVar($ProcedimientoWSRequest, SOAP_ENC_OBJECT,null,null,
'Procedimiento', self::$NAMESPACE_PET));
288 $SolicitanteWSRequest->append(
new SoapVar($this->finalidad, XSD_STRING, null, null,
'Finalidad', self::$NAMESPACE_PET));
289 $SolicitanteWSRequest->append(
new SoapVar($this->consentimiento, XSD_STRING, null, null,
'Consentimiento', self::$NAMESPACE_PET));
290 $SolicitanteWSRequest->append(
new SoapVar($FuncionarioWSRequest, SOAP_ENC_OBJECT,null,null,
'Funcionario', self::$NAMESPACE_PET));
291 if (!is_null($this->idExpediente)) {
292 $SolicitanteWSRequest->append(
new SoapVar($this->idExpediente, XSD_STRING, null, null,
'IdExpediente', self::$NAMESPACE_PET));
297 $TitularWSRequest->append(
new SoapVar($this->tipoDocumentacion, XSD_STRING, null, null,
'TipoDocumentacion', self::$NAMESPACE_PET));
298 $TitularWSRequest->append(
new SoapVar($this->documentacion, XSD_STRING, null, null,
'Documentacion', self::$NAMESPACE_PET));
299 if (!is_null($this->nombreCompleto)) {
300 $TitularWSRequest->append(
new SoapVar($this->nombreCompleto, XSD_STRING, null, null,
'NombreCompleto', self::$NAMESPACE_PET));
302 if (!is_null($this->nombre)) {
303 $TitularWSRequest->append(
new SoapVar($this->nombre, XSD_STRING, null, null,
'Nombre', self::$NAMESPACE_PET));
305 if (!is_null($this->apellido1)) {
306 $TitularWSRequest->append(
new SoapVar($this->apellido1, XSD_STRING, null, null,
'Apellido1', self::$NAMESPACE_PET));
308 if (!is_null($this->apellido2)) {
309 $TitularWSRequest->append(
new SoapVar($this->apellido2, XSD_STRING, null, null,
'Apellido2', self::$NAMESPACE_PET));
314 $TransmisionWSRequest->append(
new SoapVar($CodigoCertificado, XSD_STRING, null, null,
'CodigoCertificado', self::$NAMESPACE_PET));
315 $TransmisionWSRequest->append(
new SoapVar($IdSolicitud, XSD_STRING, null, null,
'IdSolicitud', self::$NAMESPACE_PET));
319 $DatosGenericosWSRequest->append(
new SoapVar($EmisorWSRequest, SOAP_ENC_OBJECT,null,null,
'Emisor', self::$NAMESPACE_PET));
320 $DatosGenericosWSRequest->append(
new SoapVar($SolicitanteWSRequest, SOAP_ENC_OBJECT,null,null,
'Solicitante', self::$NAMESPACE_PET));
321 $DatosGenericosWSRequest->append(
new SoapVar($TitularWSRequest, SOAP_ENC_OBJECT,null,null,
'Titular', self::$NAMESPACE_PET));
322 $DatosGenericosWSRequest->append(
new SoapVar($TransmisionWSRequest, SOAP_ENC_OBJECT,null,null,
'Transmision', self::$NAMESPACE_PET));
325 $SolicitudTransmisionWSRequest =
new ArrayObject();
326 $SolicitudTransmisionWSRequest->append(
new SoapVar($DatosGenericosWSRequest, SOAP_ENC_OBJECT,null,null,
'DatosGenericos', self::$NAMESPACE_PET));
329 if (!is_null($this->oEspecifico)) {
330 $datosEspecificosSoapVar = $this->oEspecifico->toSoap(
'DatosEspecificos', self::$NAMESPACE_ESP);
331 $SolicitudTransmisionWSRequest->append($datosEspecificosSoapVar);
336 return new SoapVar($SolicitudTransmisionWSRequest, SOAP_ENC_OBJECT,null,null,
'SolicitudTransmision', self::$NAMESPACE_PET);
353 if (is_numeric(key($array)))
355 foreach ($array as $key => $value)
357 $array[$key] = $this->array_to_objecttree($value);
361 $Object = new \stdClass;
362 foreach ($array as $key => $value)
364 if (is_array($value))
366 $Object->$key = $this->array_to_objecttree($value);
370 $Object->$key = $value;
385 if (is_array($obj) || is_object($obj))
388 foreach ($obj as $key => $value)
398 private function __anyType_SoapVar($childData, $fieldName, $namespace) {
400 if (is_a($childData,
'DateTime')) {
403 return new \SoapVar($childData->format(\DateTime::ATOM), XSD_DATETIME,
'dateTime',
'http://www.w3.org/2001/XMLSchema', $fieldName, $namespace);
404 } elseif (is_int($childData)) {
406 return new \SoapVar($childData, XSD_INTEGER, null, null, $fieldName, $namespace);
410 return new \SoapVar($childData, XSD_STRING,
'string',
'http://www.w3.org/2001/XMLSchema', $fieldName, $namespace);
413 private function __basic_SoapVar($childData, $basicType, $fieldName, $namespace) {
414 switch ($basicType) {
416 return new \SoapVar($childData->format(\DateTime::ATOM), $basicType, null, null, $fieldName, $namespace);
419 return new \SoapVar($childData, $basicType, null, null, $fieldName, $namespace);
423 public function __doChild($parentTag, $value, $fieldName, $type, $namespace, $minOccurs, $maxOccurs)
426 $fieldSet = isset($value);
428 if ($minOccurs > 0) {
429 throw new \Exception(
"No se ha encontrado el subcampo obligatorio '" . $fieldName .
'"');
435 $vChildData = $value;
436 if ($maxOccurs == 1) {
437 $vChildData = array( $value );
439 if ($maxOccurs !=
'unbounded') {
440 if ($maxOccurs >
sizeof($vChildData)) {
441 throw new \Exception(
"El campo '" . $fieldName .
'" no tiene tantas ocurrencias como se esperaban');
449 for ($iIter=0; $iIter <
sizeof($vChildData); $iIter++) {
450 $childData = $vChildData[$iIter];
452 if ((($minOccurs > 0) && $fieldSet) || $fieldSet) {
453 if (is_int($type) && $type != SOAP_ENC_OBJECT) {
457 if ($basicType !== XSD_ANYTYPE) {
458 $childSOAP = $this->__basic_SoapVar($childData, $basicType, $fieldName, $namespace);
460 $childSOAP = $this->__anyType_SoapVar($childData, $fieldName, $namespace);
462 $parentTag->append( $childSOAP );
466 $childSOAP = $childData->toSoap($fieldName, $namespace);
467 $parentTag->append( $childSOAP );
494 static public function is_assoc($array) {
495 foreach(array_keys($array) as $key) {
496 if (!is_int($key))
return true;
501 static public function endsWith($haystack, $needle) {
503 return $needle ===
"" || (($temp = strlen($haystack) - strlen($needle)) >= 0 && strpos($haystack, $needle, $temp) !==
false);
515 private $_retorno = null;
516 private $_hasRetorno =
false;
517 public function setRetorno($value) {
518 $this->_retorno = $value;
519 $this->_hasRetorno = ($value !== null);
521 public function hasRetorno() {
522 return $this->_hasRetorno;
524 public function getRetorno() {
525 return $this->_retorno;
539 if (!isset($vData[
'Retorno'])) {
540 throw new Exception(
'El parametro Retorno es obligatorio');
542 if (isset($vData[
'Retorno'])) {
545 $newItem->setRetorno($newClass);
560 public function toSoap($fieldName, $namespace) {
563 $this->__doChild($myLevel, $this->_retorno,
'Retorno', SOAP_ENC_OBJECT, $namespace, 1, 1,
false);
566 return new SoapVar($myLevel, SOAP_ENC_OBJECT, null, null, $fieldName, $namespace);
577 private $_estado = null;
578 private $_hasEstado =
false;
579 public function setEstado($value) {
580 $this->_estado = $value;
581 $this->_hasEstado = ($value !== null);
583 public function hasEstado() {
584 return $this->_hasEstado;
586 public function getEstado() {
587 return $this->_estado;
595 private $_listaVehiculos = null;
596 private $_hasListaVehiculos =
false;
597 public function setListaVehiculos($value) {
598 $this->_listaVehiculos = $value;
599 $this->_hasListaVehiculos = ($value !== null);
601 public function hasListaVehiculos() {
602 return $this->_hasListaVehiculos;
604 public function getListaVehiculos() {
605 return $this->_listaVehiculos;
619 if (!isset($vData[
'Estado'])) {
620 throw new Exception(
'El parametro Estado es obligatorio');
622 if (isset($vData[
'Estado'])) {
625 $newItem->setEstado($newClass);
627 if (isset($vData[
'ListaVehiculos'])) {
630 $newItem->setListaVehiculos($newClass);
645 public function toSoap($fieldName, $namespace) {
648 $this->__doChild($myLevel, $this->_estado,
'Estado', SOAP_ENC_OBJECT, $namespace, 1, 1,
false);
649 $this->__doChild($myLevel, $this->_listaVehiculos,
'ListaVehiculos', SOAP_ENC_OBJECT, $namespace, 0, 1,
false);
652 return new SoapVar($myLevel, SOAP_ENC_OBJECT, null, null, $fieldName, $namespace);
663 private $_codigoEstado = null;
664 private $_hasCodigoEstado =
false;
665 public function setCodigoEstado($value) {
666 $this->_codigoEstado = $value;
667 $this->_hasCodigoEstado = ($value !== null);
669 public function hasCodigoEstado() {
670 return $this->_hasCodigoEstado;
672 public function getCodigoEstado() {
673 return $this->_codigoEstado;
681 private $_codigoEstadoSecundario = null;
682 private $_hasCodigoEstadoSecundario =
false;
683 public function setCodigoEstadoSecundario($value) {
684 $this->_codigoEstadoSecundario = $value;
685 $this->_hasCodigoEstadoSecundario = ($value !== null);
687 public function hasCodigoEstadoSecundario() {
688 return $this->_hasCodigoEstadoSecundario;
690 public function getCodigoEstadoSecundario() {
691 return $this->_codigoEstadoSecundario;
699 private $_literal = null;
700 private $_hasLiteral =
false;
701 public function setLiteral($value) {
702 $this->_literal = $value;
703 $this->_hasLiteral = ($value !== null);
705 public function hasLiteral() {
706 return $this->_hasLiteral;
708 public function getLiteral() {
709 return $this->_literal;
723 if (!isset($vData[
'CodigoEstado'])) {
724 throw new Exception(
'El parametro CodigoEstado es obligatorio');
726 if (isset($vData[
'CodigoEstado'])) {
728 $newItem->setCodigoEstado($vData[
'CodigoEstado']);
730 if (isset($vData[
'CodigoEstadoSecundario'])) {
732 $newItem->setCodigoEstadoSecundario($vData[
'CodigoEstadoSecundario']);
734 if (!isset($vData[
'Literal'])) {
735 throw new Exception(
'El parametro Literal es obligatorio');
737 if (isset($vData[
'Literal'])) {
739 $newItem->setLiteral($vData[
'Literal']);
754 public function toSoap($fieldName, $namespace) {
757 $this->__doChild($myLevel, $this->_codigoEstado,
'CodigoEstado', 101, $namespace, 1, 1,
false);
758 $this->__doChild($myLevel, $this->_codigoEstadoSecundario,
'CodigoEstadoSecundario', 101, $namespace, 0, 1,
false);
759 $this->__doChild($myLevel, $this->_literal,
'Literal', 101, $namespace, 1, 1,
false);
762 return new SoapVar($myLevel, SOAP_ENC_OBJECT, null, null, $fieldName, $namespace);
772 private $_vehiculo = array();
773 private $_hasVehiculo =
false;
774 public function replaceArrayVehiculo($value) {
775 $this->_vehiculo = $value;
776 $this->_hasVehiculo = (isset($this->_vehiculo) && !empty($this->_vehiculo));
778 public function retrieveArrayVehiculo() {
779 return $this->_vehiculo;
781 public function addVehiculo($value) {
782 array_push($this->_vehiculo, $value);
783 $this->_hasVehiculo = (isset($this->_vehiculo) && !empty($this->_vehiculo));
785 public function hasVehiculo() {
786 return $this->_hasVehiculo;
788 public function getVehiculo($index) {
789 return $this->_vehiculo[$index];
791 public function countVehiculo() {
792 return count($this->_vehiculo);
806 if (!isset($vData[
'Vehiculo'])) {
807 throw new Exception(
'El parametro Vehiculo es obligatorio');
809 if (isset($vData[
'Vehiculo']) && !empty($vData[
'Vehiculo'])) {
810 if (SoapObject::is_assoc($vData[
'Vehiculo'])) {
814 $newItem->addVehiculo($newClass);
817 foreach ($vData[
'Vehiculo'] as $oVar) {
819 $newItem->addVehiculo($newClass);
836 public function toSoap($fieldName, $namespace) {
839 $this->__doChild($myLevel, $this->_vehiculo,
'Vehiculo', SOAP_ENC_OBJECT, $namespace, 1, unbounded,
false);
842 return new SoapVar($myLevel, SOAP_ENC_OBJECT, null, null, $fieldName, $namespace);
853 private $_matricula = null;
854 private $_hasMatricula =
false;
855 public function setMatricula($value) {
856 $this->_matricula = $value;
857 $this->_hasMatricula = ($value !== null);
859 public function hasMatricula() {
860 return $this->_hasMatricula;
862 public function getMatricula() {
863 return $this->_matricula;
877 if (!isset($vData[
'Matricula'])) {
878 throw new Exception(
'El parametro Matricula es obligatorio');
880 if (isset($vData[
'Matricula'])) {
882 $newItem->setMatricula($vData[
'Matricula']);
897 public function toSoap($fieldName, $namespace) {
900 $this->__doChild($myLevel, $this->_matricula,
'Matricula', 101, $namespace, 1, 1,
false);
903 return new SoapVar($myLevel, SOAP_ENC_OBJECT, null, null, $fieldName, $namespace);
toSoap($fieldName, $namespace)
setProcedimiento($codigo, $nombre)
setTitular($tipoDocumentacion, $documentacion, $nombreCompleto=null, $nombre=null, $apellido1=null, $apellido2=null)
toSoap($fieldName, $namespace)
toSoap($fieldName, $namespace)
setEspecifico($oEspecifico)
setFuncionario($nombreCompleto, $nif)
toSoap($IdPeticion, $CodigoCertificado, $numParcial=null)
toSoap($fieldName, $namespace)
setSolicitante($identificadorSolicitante, $nombreSolicitante, $consentimiento, $finalidad, $unidadTramitadora=null, $idExpediente=null)
toSoap($fieldName, $namespace)