perhaps you forgot to load "URI"?

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::Data->name('estado')->type(string => $estado),
SOAP::Data->name('remedyid')->type(long => $remedyid),
SOAP::Data->name('usumod')->type(string => $usumod),
SOAP::Data->name('historial')->type(string => $historial),
SOAP::Data->name('telcontacto')->type(string => $telcontacto),
SOAP::Data->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
 
X

xhoster

John said:
Hi

I had a similar problem when we moved to a new server.

Can't locate object method "new" via package "SOAP::packager::MIME"
(perhaps you forgot to load "SOAP::packager::MIME"?) at
/usr/lib/perl5/site_perl/5.8.6/SOAP/Lite.pm line 3241.

At first, we thought that the package MIME was missing but once we
re-installed
SOAP Lite (force installation) it was OK.

This is because there are two SOAP::packager modules, one part of
SOAP and one part of SOAP::Lite. SOAP::Lite's defines MIME internally,
and SOAP's doesn't. So if SOAP::Lite loads SOAP's version, it fails. When
you reinstalled, either SOAP::Lite's module overwrite SOAP's, or it was
installed into a place that came earlier in @INC.


http://search.cpan.org/src/KBROWN/SOAP-0.28/lib/SOAP/Packager.pm
http://search.cpan.org/src/BYRNE/SOAP-Lite-0.69/lib/SOAP/Packager.pm

It might be that package URI is missing, but, my guess a fresh
installation odf SOAP::Lite will fix it.

I bet the OP's problem is similar. Instead of loading a SOAP::Lite module
which has a "use URI" in it, it loads a same-named SOAP module which
doesn't have "use URI" in it.

Xho
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top