Ver Mensaje Individual
  #1  
Antiguo 28-11-2008
marilinspi marilinspi is offline
Miembro
 
Registrado: ene 2007
Posts: 136
Reputación: 18
marilinspi Va por buen camino
Enviar TRA al WSAA

hola a todos estoy con el tema de la factura electronica... ya consegui el certificado x509 y crear el TRA, ahora en lo que necesito ayuda es en como enviarlo al WSAA, tengo un ejemplo en PHP pero no logro reproducirlo en Delphi talvez alguien de ustedes conozca los dos lenguajes y me pueda ayudar o sino alguien que ya haya pasado por esta situacion y lo resolvio que me de una mano. aca va el codigo en PHP

Cita:
Input:
WSDL, CERT, PRIVATEKEY, PASSPHRASE, SERVICE, WSAAURL
Check below for its definitions
Output:
TA.xml: the authorization ticket as granted by WSAA.
==============================================================================
define ("WSDL", "wsaa.wsdl"); # The WSDL corresponding to WSAA
define ("CERT", "ghf.crt"); # The X.509 obtained from Seg. Inf.
define ("PRIVATEKEY", "ghf.key"); # The private key correspoding to CERT
define ("PASSPHRASE", "xxxxxxx"); # The passphrase (if any) to sign
SERVICE: The WS service name you are asking a TA for
define ("SERVICE", "wsfe");
WSAAURL: the URL to access WSAA, check for http or https and wsaa or wsaahomo
define ("WSAAURL", "https://wsaa.afip.gov.ar/ws/services/LoginCms");
define ("WSAAURL", "https://wsaahomo.afip.gov.ar/ws/services/LoginCms");



function SignTRA()
{
$STATUS=openssl_pkcs7_sign("TRA.xml", "TRA.tmp", "file://".CERT,
array("<A href="file://".PRIVATEKEY/">file://".PRIVATEKEY, PASSPHRASE),
array(),
!PKCS7_DETACHED
);
if (!$STATUS) {exit("ERROR generating PKCS#7 signature\n");}
$inf=fopen("TRA.tmp", "r");
$i=0;
$CMS="";
while (!feof($inf))
{
$buffer=fgets($inf);
if ( $i++ >= 4 ) {$CMS.=$buffer;}
}
fclose($inf);
unlink("TRA.xml");
unlink("TRA.tmp");
return $CMS;
}
desde ya muchas gracias.

Última edición por marilinspi fecha: 28-11-2008 a las 14:13:19.
Responder Con Cita