/** * @param array $mensaje * @return string */ function op__test(toba_servicio_web_mensaje $mensaje) { $array = $mensaje->get_array(); $id = $this->get_id_cliente(); if (isset($id)) { $id = "No presente"; } else { $id = var_export($id); } $id = xml_encode($id); $payload = array("Clave: {$array['clave']}. Valor: {$array['valor']}. ID: {$id}"); return new toba_servicio_web_mensaje($payload); }
function send(toba_servicio_web_mensaje $mensaje) { try { $this->wsf->send($mensaje->wsf()); } catch (WSFault $fault) { self::get_modelo_proyecto($this->proyecto); toba::logger()->debug("Request: " . $this->wsf->getLastRequest()); toba::logger()->debug("Response: " . $this->wsf->getLastResponse()); $detalle = isset($fault->Detail) ? $fault->Detail : ''; throw new toba_error_servicio_web($fault->Reason, $fault->Code, $detalle); } catch (Exception $e) { throw new toba_error_comunicacion($e->getMessage(), $this->opciones, $this->wsf->getLastResponseHeaders()); } }
function op__enviar_excepcion(toba_servicio_web_mensaje $mensaje) { $datos = $mensaje->get_array(); throw new toba_error_servicio_web($datos['mensaje'], $datos['codigo'], "Excepcion de prueba enviada"); }
/** * Retorna la misma cadena enviada al servidor * @param string $texto texto a repetir * @return string $texto texto repetido */ function op__eco(toba_servicio_web_mensaje $mensaje) { toba::logger()->debug('Entro al servicio web'); $xml = new SimpleXMLElement($mensaje->get_payload()); toba::logger()->debug('El payload para testeo es: ' . $xml->texto); $texto = xml_encode(xml_decode($xml->texto)); $payload = <<<XML <ns1:eco xmlns:ns1="http://siu.edu.ar/toba/pruebas"> \t<texto>{$texto}</texto> </ns1:eco> XML; return new toba_servicio_web_mensaje($payload); }
/** * Responde exactamente con la misma cadena enviada * @param string $texto texto a repetir * @return string $texto texto repetido */ function op__test(toba_servicio_web_mensaje $mensaje) { $xml = new SimpleXMLElement($mensaje->get_payload()); $texto = xml_encode(xml_decode($xml->texto)); $dependencia = xml_encode($this->get_id_cliente('dependencia')); $payload = <<<XML <ns1:test xmlns:ns1="http://siu.edu.ar/toba_referencia/pruebas"> \t<texto>Texto: {$texto} \tDependencia: {$dependencia}</texto> </ns1:test> XML; return new toba_servicio_web_mensaje($payload); }