WSCOMUN  2.0.0
Web Services Comunes para PHP/GVHidra
WSClientAutoriza.php
1 <?php
14 
16 {
17 
28  public function retornaAutorizacionWS ($usuarioHDFI, $idAplicacion)
29  {
30  try
31  {
32  $this->__clienteOn(self::KEYCLIENTE_AUTORIZA);
33  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_AUTORIZA];
34 
35  $retornaAutorizacionWS = new ArrayObject();
36  $retornaAutorizacionWS->append(new SoapVar($usuarioHDFI,XSD_STRING,null,null,'usuarioHDFI', self::$NAMESPACE_GVA));
37  $retornaAutorizacionWS->append(new SoapVar($idAplicacion,XSD_STRING,null,null,'idAplicacion', self::$NAMESPACE_GVA));
38  $miSoapRQ = new SoapVar($retornaAutorizacionWS, SOAP_ENC_OBJECT,null,null,'retornaAutorizacionWSRequest', self::$NAMESPACE_GVA);
39 
40  $lista = $clienteWS->retornaAutorizacionWS($miSoapRQ);
41 
42  if ($this->getDebugMode())
43  {
44  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
45  if (is_object($clienteWS))
46  {
47  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
48  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
49  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
50  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
51  }
52  }
53 
54  }
55  catch (Exception $e)
56  {
57  if ($this->getDebugMode())
58  {
59  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
60  if (is_object($clienteWS))
61  {
62  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
63  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
64  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
65  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
66  }
67  throw $e;
68  }
69  else throw $e;
70  }
71 
72  //Tratamos la información obtenida del WS
73  try
74  {
75  if (!is_object($lista))
76  {
77  if ($this->getDebugMode())
78  {
79  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
80  $this->addDebugInfo("\nLista de autorizaciones vacía\n");
81  }
82  else
83  return array();
84  }
85 
86  $vLista = array();
87  foreach ($lista->permisoapp as $objeto)
88  {
89  $vLista[] = array
90  (
91  'nif' => $objeto->nif,
92  'usrTipo' => $objeto->usrtipo,
93  'idGrupo'=> $objeto->idgrupo,
94  'idRol' => $objeto->idrol,
95  'idAplicacion'=>$objeto->idaplicacion
96  );
97  }
98 
99  return $vLista;
100 
101  }
102  catch (Exception $e)
103  {
104  if ($this->getDebugMode())
105  {
106  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'.'. Error en el tratmineo del objeto lista');
107  }
108  }
109  }//retornaAutorizacionWS
110 
111 
121  public function retornaTodasAutorizacionesWS ($usuarioHDFI)
122  {
123  try
124  {
125  $this->__clienteOn(self::KEYCLIENTE_AUTORIZA);
126  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_AUTORIZA];
127 
128  $retornaTodasAutorizacionesWS = new ArrayObject();
129  $retornaTodasAutorizacionesWS->append(new SoapVar($usuarioHDFI,XSD_STRING,null,null,'usuarioHDFI', self::$NAMESPACE_GVA));
130 
131  $miSoapRQ = new SoapVar($retornaTodasAutorizacionesWS, SOAP_ENC_OBJECT,null,null,'retornaTodasAutorizacionesWSRequest', self::$NAMESPACE_GVA);
132 
133  $lista = $clienteWS->retornaTodasAutorizacionesWS($miSoapRQ);
134 
135  if ($this->getDebugMode())
136  {
137  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
138  if (is_object($clienteWS))
139  {
140  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
141  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
142  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
143  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
144  }
145  }
146 
147  }
148  catch (Exception $e)
149  {
150  if ($this->getDebugMode())
151  {
152  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
153  if (is_object($clienteWS))
154  {
155  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
156  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
157  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
158  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
159  }
160  throw $e;
161  }
162  else throw $e;
163  }
164 
165  //Tratamos la información obtenida del WS
166  try
167  {
168 
169  if (!is_object($lista))
170  {
171  if ($this->getDebugMode())
172  {
173  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
174  $this->addDebugInfo("\nLista de autorizaciones vacía\n");
175  }
176  else
177  return array();
178  }
179 
180  /*
181  [usrcodigo] => 37178
182  [usrtipo] => U
183  [idgrupo] => 380
184  [idrol] =>
185  */
186  $vLista = array();
187 
188  //Devuelve un array de objetos, o un sólo objeto. Si es array...
189  if (is_array($lista->lista_permisos)) foreach ($lista->lista_permisos as $objeto)
190  {
191  $vLista[] = array(
192  'usrCodigo'=> $objeto->usrcodigo,
193  'usrTipo'=>$objeto->usrtipo,
194  'idGrupo'=>$objeto->idgrupo,
195  'idRol'=>$objeto->idrol
196  );
197  }
198  else //Si es un sólo registro
199  $vLista[] = array(
200  'usrCodigo'=> $lista->lista_permisos->usrcodigo,
201  'usrTipo'=>$lista->lista_permisos->usrtipo,
202  'idGrupo'=>$lista->lista_permisos->idgrupo,
203  'idRol'=>$lista->lista_permisos->idrol
204  );
205 
206  return $vLista;
207  }
208  catch (Exception $e)
209  {
210  if ($this->getDebugMode())
211  {
212  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'.'. Error en el tratmineo del objeto lista');
213  }
214  }
215  }//Fin retornaTodasAutorizacionesWS
216 
217 
218 
229  public function retornaTodasAutorizacionesDNIWS ($usuarioDNI, $tipoBusqueda)
230  {
231  $lista = null;
232  try
233  {
234  $this->__clienteOn(self::KEYCLIENTE_AUTORIZA);
235  $clienteWS = $this->v_clienteWS[self::KEYCLIENTE_AUTORIZA];
236 
237  $retornaTodasAutorizacionesDNIWS = new ArrayObject();
238  $retornaTodasAutorizacionesDNIWS->append(new SoapVar($usuarioDNI,XSD_STRING,null,null,'usuarioDNI', self::$NAMESPACE_GVA));
239  $retornaTodasAutorizacionesDNIWS->append(new SoapVar($tipoBusqueda,XSD_STRING,null,null,'tipoBusqueda', self::$NAMESPACE_GVA));
240  $miSoapRQ = new SoapVar($retornaTodasAutorizacionesDNIWS, SOAP_ENC_OBJECT,null,null,'retornaTodasAutorizacionesDNIWSRequest', self::$NAMESPACE_GVA);
241 
242  $lista = $clienteWS->retornaTodasAutorizacionesDNIWS($miSoapRQ);
243 
244  if ($this->getDebugMode())
245  {
246  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
247  if (is_object($clienteWS))
248  {
249  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
250  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
251  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
252  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
253  }
254  }
255  }
256  catch (Exception $e)
257  {
258  if ($this->getDebugMode())
259  {
260  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
261  if (is_object($clienteWS))
262  {
263  $this->addDebugInfo("RqH:\n ".$clienteWS->__getLastRequestHeaders());
264  $this->addDebugInfo("Rq:\n ".$clienteWS->__getLastRequest());
265  $this->addDebugInfo("RsH:\n ".$clienteWS->__getLastResponse());
266  $this->addDebugInfo("Rs:\n ".$clienteWS->__getLastResponseHeaders());
267  }
268  throw $e;
269  }
270  else throw $e;
271  }
272 
273  //Tratamos la información obtenida del WS
274  try
275  {
276  if (!is_object($lista))
277  {
278  if ($this->getDebugMode())
279  {
280  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'."\n");
281  $this->addDebugInfo("\nLista de autorizaciones vacía\n");
282  }
283  else
284  return array();
285  }
286 
287  $vLista = array();
288 
289  //Devuelve un array de objetos, o un sólo objeto. Si es array...
290  if (is_array($lista->lista)) foreach ($lista->lista as $objeto)
291  {
292  $vLista[] = array(
293  'usrCodigo'=> $objeto->usrcodigo,
294  'usrTipo'=>$objeto->usrtipo,
295  'idGrupo'=>$objeto->idgrupo,
296  'idRol'=>$objeto->idrol
297  );
298  }
299  else //Si es un sólo registro
300  $vLista[] = array(
301  'usrCodigo'=> $lista->lista->usrcodigo,
302  'usrTipo'=>$lista->lista->usrtipo,
303  'idGrupo'=>$lista->lista->idgrupo,
304  'idRol'=>$lista->lista->idrol
305  );
306 
307  return $vLista;
308 
309  }
310  catch (Exception $e)
311  {
312  if ($this->getDebugMode())
313  {
314  $this->addDebugInfo(__CLASS__.':'.__METHOD__.'['.__FILE__.'-'.__LINE__.']'.'. Error en el tratamiento del objeto lista');
315  }
316  }
317  }//retornaTodasAutorizacionesDNIWS
318 
319 }
320 
321 
322 ?>
__clienteOn($tipo, $trazabilidadPai=true, $opcionesClienteWS=null)
retornaTodasAutorizacionesDNIWS($usuarioDNI, $tipoBusqueda)
retornaTodasAutorizacionesWS($usuarioHDFI)
retornaAutorizacionWS($usuarioHDFI, $idAplicacion)