perhaps you forgot to load "URI"?

Discussion in 'Perl Misc' started by Jorge Reyes, Aug 25, 2007.

  1. Jorge Reyes

    Jorge Reyes Guest

    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
    Jorge Reyes, Aug 25, 2007
    #1
    1. Advertising

  2. Jorge Reyes

    Guest

    "John" <> wrote:
    > >
    > > 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
    > >

    >
    > 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

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    , Aug 25, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Simon Harris
    Replies:
    0
    Views:
    6,351
    Simon Harris
    May 10, 2005
  2. Stanimir Stamenkov
    Replies:
    1
    Views:
    2,455
    Stanimir Stamenkov
    Aug 17, 2005
  3. Pavel
    Replies:
    2
    Views:
    1,627
    Peter Flynn
    Aug 4, 2004
  4. etheriau
    Replies:
    1
    Views:
    662
    Pavel
    Aug 23, 2004
  5. GMI
    Replies:
    3
    Views:
    484
    Tad McClellan
    Jun 19, 2005
Loading...

Share This Page