J
Jorge Reyes
hi, so now this is weird, first of all i want to say that this script
runs ok in windows xp, linux ubuntu 7.04 and the problem is when i put
this into a unix machine this is the code:
use SOAP::Lite qw (debug trace);
$log_folder = "logwsremedyclient";
$fechaActual = &fechaHoraFormatoDb(time);
$log_name = substr($fechaActual,0,10);
$log_name =~ tr/-//d;
$log_name = $log_name.".log";
#print $log_folder.$log_name."\n";
if (! -d $log_folder ) {
#no existe
mkdir($log_folder) || die "ERROR AL INTENTAR CREAR EL
DIRECTORIO: $log_folder";
}
$numArgs = $#ARGV + 1;
if($numArgs < 6) {
$header = "INICIO.- $fechaActual\n";
$content = "ERROR: SE RECIBIERON $numArgs COMMAND-LINE
ARGUMENTS, IMPOSIBLE CONTINUAR SE NECESITAN 6\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
exit(1);
}
my $estado = $ARGV[0];
my $remedyid = $ARGV[1];
my $usumod = $ARGV[2];
my $historial = $ARGV[3];
my $telcontacto = $ARGV[4];
my $usua_afec = $ARGV[5];
#my $estado = 'CERRADO';
#my $remedyid = 263;
#my $usumod = 'JORGE REYES';
#my $historial = 'PRUEBA 2 DESDE PERL HACIA WS EN JAVA';
#my $telcontacto = '5530304857';
#my $usua_afec = 8;
my $soap = SOAP::Lite
-> uri('http://serviciosweb.remedyweb.iusacell.com')
-> proxy('http://10.199.11.69:9080/remedyWeb/services/
ActualizaStatus')
-> on_action( sub { join '', @_} );
my $s = $soap->paramRemedy(
SOAP:
ata->name('estado')->type(string => $estado),
SOAP:
ata->name('remedyid')->type(long => $remedyid),
SOAP:
ata->name('usumod')->type(string => $usumod),
SOAP:
ata->name('historial')->type(string => $historial),
SOAP:
ata->name('telcontacto')->type(string => $telcontacto),
SOAP:
ata->name('usua_afec')->type(int => $usua_afec));
unless ($s->fault) {
#print $s->result();
$header = "INICIO.- $fechaActual\n";
$content = "estado: $ARGV[0]\nremedyid: $ARGV[1]\nusumod:
$ARGV[2]\nhistorial: $ARGV[3]\ntelcontacto: $ARGV[4]\nusua_afec:
$ARGV[5]\nRESPUESTA: ".$s->result()."\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
}
else {
#print "\n\nError\n";
#print join ', ',
#$s->faultcode,
#$s->faultstring,
#$s->faultdetail,"\n\n";
$header = "INICIO.- $fechaActual\n";
$content = "ERROR: ".join ', ',$s->faultcode, $s->faultstring,
$s->faultdetail, "\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
}
sub fechaHoraFormatoDb {
# $_[0] = Unix time, or POSIX time
# NOTA: Al llamar a esta subrutina no poner comillas el
parametro de $_[0]
# Ej: &fechaHoraFormatoDb(time) o &fechaHoraFormatoDb($valor)
my ($segundo,$minuto,$hora,$dia,$mes,$anio,$diaSemana) =
(localtime($_[0]))[0,1,2,3,4,5,6];
my @mesesNum =
('01','02','03','04','05','06','07','08','09','10','11','12');
my $tiempo = sprintf("%02d:%02d:%02d",$hora,$minuto,$segundo);
$anio = $anio + 1900;
if($dia < 10) {
$dia="0$dia";
}
$tiempoObtenido="$anio-$mesesNum[$mes]-$dia $tiempo";
return $tiempoObtenido;
}
and then when i executed it the answer is:
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
Can't locate object method "new" via package "URI" (perhaps you forgot
to load "URI"?) at /usr/perl5/5.6.1/lib/HTTP/Request.pm line 82.
so any idea suggestions or something useful, sorry but i am desperate
jeje... thanks for advanced
runs ok in windows xp, linux ubuntu 7.04 and the problem is when i put
this into a unix machine this is the code:
use SOAP::Lite qw (debug trace);
$log_folder = "logwsremedyclient";
$fechaActual = &fechaHoraFormatoDb(time);
$log_name = substr($fechaActual,0,10);
$log_name =~ tr/-//d;
$log_name = $log_name.".log";
#print $log_folder.$log_name."\n";
if (! -d $log_folder ) {
#no existe
mkdir($log_folder) || die "ERROR AL INTENTAR CREAR EL
DIRECTORIO: $log_folder";
}
$numArgs = $#ARGV + 1;
if($numArgs < 6) {
$header = "INICIO.- $fechaActual\n";
$content = "ERROR: SE RECIBIERON $numArgs COMMAND-LINE
ARGUMENTS, IMPOSIBLE CONTINUAR SE NECESITAN 6\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
exit(1);
}
my $estado = $ARGV[0];
my $remedyid = $ARGV[1];
my $usumod = $ARGV[2];
my $historial = $ARGV[3];
my $telcontacto = $ARGV[4];
my $usua_afec = $ARGV[5];
#my $estado = 'CERRADO';
#my $remedyid = 263;
#my $usumod = 'JORGE REYES';
#my $historial = 'PRUEBA 2 DESDE PERL HACIA WS EN JAVA';
#my $telcontacto = '5530304857';
#my $usua_afec = 8;
my $soap = SOAP::Lite
-> uri('http://serviciosweb.remedyweb.iusacell.com')
-> proxy('http://10.199.11.69:9080/remedyWeb/services/
ActualizaStatus')
-> on_action( sub { join '', @_} );
my $s = $soap->paramRemedy(
SOAP:
SOAP:
SOAP:
SOAP:
SOAP:
SOAP:
unless ($s->fault) {
#print $s->result();
$header = "INICIO.- $fechaActual\n";
$content = "estado: $ARGV[0]\nremedyid: $ARGV[1]\nusumod:
$ARGV[2]\nhistorial: $ARGV[3]\ntelcontacto: $ARGV[4]\nusua_afec:
$ARGV[5]\nRESPUESTA: ".$s->result()."\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
}
else {
#print "\n\nError\n";
#print join ', ',
#$s->faultcode,
#$s->faultstring,
#$s->faultdetail,"\n\n";
$header = "INICIO.- $fechaActual\n";
$content = "ERROR: ".join ', ',$s->faultcode, $s->faultstring,
$s->faultdetail, "\n";
$footer = "FINAL.- $fechaActual\n\n";
open(WSLOG,">> $log_folder/$log_name") || die "ERROR AL
INTENTAR ABRIR EL LOG: $log_folder/$log_name";
print WSLOG $header.$content.$footer;
close(WSLOG);
}
sub fechaHoraFormatoDb {
# $_[0] = Unix time, or POSIX time
# NOTA: Al llamar a esta subrutina no poner comillas el
parametro de $_[0]
# Ej: &fechaHoraFormatoDb(time) o &fechaHoraFormatoDb($valor)
my ($segundo,$minuto,$hora,$dia,$mes,$anio,$diaSemana) =
(localtime($_[0]))[0,1,2,3,4,5,6];
my @mesesNum =
('01','02','03','04','05','06','07','08','09','10','11','12');
my $tiempo = sprintf("%02d:%02d:%02d",$hora,$minuto,$segundo);
$anio = $anio + 1900;
if($dia < 10) {
$dia="0$dia";
}
$tiempoObtenido="$anio-$mesesNum[$mes]-$dia $tiempo";
return $tiempoObtenido;
}
and then when i executed it the answer is:
SOAP::Lite::call: ()
SOAP::Serializer::envelope: ()
Can't locate object method "new" via package "URI" (perhaps you forgot
to load "URI"?) at /usr/perl5/5.6.1/lib/HTTP/Request.pm line 82.
so any idea suggestions or something useful, sorry but i am desperate
jeje... thanks for advanced