caribesoft has asked for the wisdom of the Perl Monks concerning the following question:

Hi evereybody : I have the following script, that send a SOAP:Message to a Server, I receive the response and It's supposed to be a data array, and I need to insert it into a MySql Table, whe I print it I can only see the last record of the array, can anyone give me a tip of how can I print and then insert into a Mysql table the entire array ?
#!c:\perl\bin/Perl.exe -l use SOAP::Lite +trace => [qw(debug)]; $SOAP::Constants::DO_NOT_USE_CHARSET = 1; # En caso de .NET print "Content-type: text/html; charset=iso-8859-1\n\n"; my $soap = SOAP::Lite->new( uri => 'http://Recintos/ServiciosWebXml/', proxy => 'http://192.168.220.108/wsrefis/RecintosFis.asmx?WS +DL', outputxml => 1, readable => 1, namespace => 'soap', encodingspace => '', xmlschema => 'http://www.w3.org/2001/XMLSchema', encodingStyle => '', use_prefix => 0, on_action => sub{join '', @_}, # En caso de .NET ); my $fecini = "01-06-2006"; my $fecfin = "30-06-2006"; my @parametros = ( SOAP::Header->name( 'EncabezadoSOAP'=> \SOAP::Data->value ( SOAP::Data->name (idUsuario => 'API940504EPA'), SOAP::Data->name (firma => 1239), SOAP::Data->name (ipCliente => ''), ), )->attr({xmlns=>'http://Recintos/ServiciosWebXml/'}), SOAP::Data->name (fechaIni => $fecini), SOAP::Data->name (fechaFin => $fecfin), SOAP::Data->name (buque => 'ARGOSY'), ); my $response = $soap->call( SOAP::Data->name('consultaManifPorFecha') ->attr({xmlns => 'http://Recintos/ServiciosWebXml/'} ) => @parametros); my $d = SOAP::Custom::XML::Deserializer -> deserialize(join '', $response) -> valueof('/Envelope/Body'); my $man = $d->consultaManifPorFechaResponse->consultaManifPorFechaResu +lt->man; my @campos = qw( nTrans cTransp idTransp nomBuque numViaje fecEstimada tipoOper lineaNaviera cuAduana cuPais cuPuerto cuEntidadMan ); foreach my $campo ( @campos ) { print "<p style='margin-top: 0; margin-bottom: 0'>$campo: ", $man- +>$campo,"\n"; } __END__
In advance thank you....

Replies are listed 'Best First'.
Re: SOAP message response
by shmem (Chancellor) on Jul 20, 2006 at 15:32 UTC
    I don't really have a clue, but something looks strange to me:
    my $response = $soap->call( ... )
    and later
    -> deserialize(join '', $response)

    You write:

    I receive the response and It's supposed to be a data array

    So, I'd expect either

    my @response = $soap->call( ... ) ... ->deserialize(join '', @response)
    or
    my $response = $soap->call( ... ) ... ->deserialize(join '', @$response)

    Did you check what $response / @response really is?

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
Re: SOAP message response
by Ieronim (Friar) on Jul 20, 2006 at 18:13 UTC
    Where in your code is the array you want to insert in MySQL table? I don't see anything that looks like it.

         s;;Just-me-not-h-Ni-m-P-Ni-lm-I-ar-O-Ni;;tr?IerONim-?HAcker ?d;print