Example #1
0
<?php

session_start();
if (isset($_SESSION['login'])) {
    header('Content-type: text/html; charset=utf-8');
    $id_cliente = $_REQUEST['id'];
    try {
        $cliente = new SoapClient("http://10.177.73.45/TNDWebSvc/Service.asmx?WSDL");
        $parameter = array('descriptionOc' => $id_cliente);
        //debe ser null
        $obj_result = $cliente->getOcThink($parameter);
        $simple_result = $obj_result->getOcThinkResult;
        if (!empty($simple_result->informacion_oc)) {
            //valido si el objeto esta definido
            $arrayFinal = $simple_result->informacion_oc;
            echo "<table class='css3' cellspacing='0' style='font-size: 13px;' id='mdata'>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr style='font-weight: bold;'>\n\t\t\t\t\t\t<td>OC ID</td>\n\t\t\t\t\t\t<td>Descripción</td>\n\t\t\t\t\t\t<td>&nbsp;</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t\t<tbody>\t\t\n\t\t";
            foreach ($arrayFinal as $indice => $valor) {
                echo "\n\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $arrayFinal[$indice]->oc_id . "</td>\n\t\t\t\t\t\t<td>" . $arrayFinal[$indice]->description . "</td>\n\t\t\t\t\t\t<td><a class='on' id='" . $arrayFinal[$indice]->oc_id . "'>\n\t\t\t\t\t\t\t\t<button class='mp' type='button'  id='" . $arrayFinal[$indice]->oc_id . "'>Usar</button>\n\t\t\t\t\t\t\t</a>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<input type='hidden' name='indice' id='indice' value='" . $indice . "' />\n\t\t\t\t</tr>\t\t\n\t\t\t\t";
                //echo "<br>". $arrayFinal[$indice] -> oc_id;
            }
            echo "</tbody>\n\t\t\t</table>";
        } else {
            echo "Sin datos";
        }
        /*
        echo "<pre>";
        print_r($simple_result);		//es un objeto;
        echo "</pre>";
        */
    } catch (SoapFault $exception) {
        echo $exception;
Example #2
0
            default:
                $out[$key] = $val;
        }
    }
    return $out;
}
$id_cliente = 'IDC';
try {
    echo "Prueba<br/>";
    $servicio = "http://10.177.73.45/TNDWebSvc/Service.asmx?WSDL";
    //url del servicio
    $parametros = array();
    //parametros de la llamada
    $parametros['descriptionOc'] = $id_cliente;
    $client = new SoapClient($servicio, $parametros);
    $result = $client->getOcThink($parametros);
    //llamamos al métdo que nos interesa con los parámetro
    $noticias = $result;
    $n = count($noticias);
    //procesamos el resultado como con cualquier otro array
    for ($i = 0; $i < $n; $i++) {
        $noticia = $noticias[$i];
        $id = $noticia[‘id’];
        //aquí iría el resto de tu código donde procesas los datos recibidos
    }
    //$simple_result = $obj_result->getOcThinkResult ;		//regresa un solo objeto AMEX
    //		//es un objeto;
    //if ($simple_result->id_clienteIn != 0)
    //echo '<br/>apellido M: <br/>'.$simple_result->apellido_materno;
} catch (SoapFault $exception) {
    echo $exception;