I used the program stubmaker.pl 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="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<GetMoviesResponse xmlns="http://www.dtmovies.com/websvcs/">
<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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|