Exemplo n.º 1
0
    unlink("TRA.tmp");
    return $CMS;
}
function CallWSAA($CMS)
{
    $client = new SoapClient(WSDLA, array('soap_version' => SOAP_1_2, 'location' => URL, 'trace' => 1, 'exceptions' => 0));
    $results = $client->loginCms(array('in0' => $CMS));
    file_put_contents("request-loginCms.xml", $client->__getLastRequest());
    file_put_contents("response-loginCms.xml", $client->__getLastResponse());
    if (is_soap_fault($results)) {
        exit("SOAP Fault: " . $results->faultcode . "\n" . $results->faultstring . "\n");
    }
    return $results->loginCmsReturn;
}
$SERVICE = $argv[1];
CreateTRA($SERVICE);
$CMS = SignTRA();
$TA = CallWSAA($CMS);
if (!file_put_contents("TA.xml", $TA)) {
    exit;
}
$ta_xml = simplexml_load_string($TA);
$TOKEN = $ta_xml->credentials->token;
$SIGN = $ta_xml->credentials->sign;
$opts = array('ssl' => array('ciphers' => 'RC4-SHA'));
$client_wsfe = new SoapClient(WSDL, array('trace' => true, 'encoding' => 'UTF-8', 'cache_wsdl' => WSDL_CACHE_BOTH, 'stream_context' => stream_context_create($opts), "exceptions" => false));
// metodo para probar si se conecta
//$results_AutRequest = $client_wsfe->FEDummy();
/*
  //////////////////
  $results_AutRequest = $client_wsfe->FECompUltimoAutorizado(
Exemplo n.º 2
0
function CallWSAA($CMS)
{
    # Now we create a context to specify remote web server certificate checking
    # If you don want to check remote server, you may set verify_peer to FALSE.
    $ctx = stream_context_create(array('ssl' => array('CN_match' => REMCN, 'cafile' => REMCACERT, 'allow_self_signed' => REMSELFSIGN, 'verify_peer' => REMVERIFY)));
    $client = new SoapClient(WSDL, array('stream_context' => $ctx, 'soap_version' => SOAP_1_2, 'location' => WSAAURL, 'exceptions' => 0));
    $results = $client->loginCms(array('in0' => $CMS));
    if (is_soap_fault($results)) {
        exit("SOAP Fault: " . $results->faultcode . "\n" . $results->faultstring . "\n");
    }
    return $results->loginCmsReturn;
}
#==============================================================================
ini_set("soap.wsdl_cache_enabled", "0");
if (!file_exists(CERT)) {
    exit("Failed to open " . CERT . "\n");
}
if (!file_exists(PRIVATEKEY)) {
    exit("Failed to open " . PRIVATEKEY . "\n");
}
if (!file_exists(WSDL)) {
    exit("Failed to open " . WSDL . "\n");
}
CreateTRA();
$CMS = SignTRA();
$TA = CallWSAA($CMS);
if (!file_put_contents("TA.xml", $TA)) {
    exit("Error writing TA.xml\n");
} else {
    echo "listo el pollo, pelada la gallina";
}