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

I used the program that's distributed with SOAP::Lite to create an SOAP client and I can't seem to retrieve the data correctly. The relative snippet of code is this:

my $som = $self ->endpoint($method{endpoint}) ->uri($method{uri}) ->on_action( sub { qq/"$method{soapaction}"/ } ) ->call($method => map { @templates ? shift(@templates)->value( +$_) : $_ } @_); return $som unless UNIVERSAL::isa($som => 'SOAP::SOM'); return wantarray ? $som->paramsall : $som->result;

I used Data::Dumper on the SOAP::SOM ($som) object that was returned and buried deep in the data structure is the data that I need. $self->call is returning a SOAP::SOM object and I'm calling it in list context, so it's the $som->paramsall method which is failing. It returns the following data structure:

@movies = ( { 'Movies' => { 'Movie' => '' } } );

The XML returned by the SOAP call resembles the following (with many thousands of movies cut out and this is actually returned on one line.)

<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd=""> <soap:Body> <GetMoviesResponse xmlns=""> <GetMoviesResult> <Movies xmlns=""> <Movie Title="10 Things I Hate About You" FilmID="474" /> <Movie Title="102 Dalmatians" FilmID="912" /> <Movie Title="13 Going on 30" FilmID="1496" /> <Movie Title="15 Minutes" FilmID="966" /> </Movies> </GetMoviesResult> </GetMoviesResponse> </soap:Body> </soap:Envelope>

Do you see anything wrong with the above? Would providing a snippet of the (long) data structure in $som be useful? Should I just run my head through a meat grinder instead? Inquiring minds want to know.

I'm using SOAP::Lite version 0.60.

Cross-posted to the SOAP::Lite mailing list.

Update: I've developed a workaround by setting $self->outputxml(1) and using XML::Simple to parse the data. I'd rather not do that but at least it works.


New address of my CGI Course.