Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But, after spending hours trying to decipher the documentation of SOAP::Lite (and ::SOM) I cannot for the life of me figure out how to access (as variables) some of the sub elements of the data that is returned. I'd like to code something similar to the following pseudo code:my $soap = SOAP::Lite -> proxy($url); my $res = $soap->$method(@data); use Data::Dumper; print Dumper($res)
out of the following sample data (in XML for brevity)Foreach campaign in campaigns { print $campaign{Name}; print $campaign{Cost}; print $campaign{Sessions}{Number}; print $campaign{Sessions}{TotalVisits}; }
Thanks for any help.<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/env +elope/"> <SOAP-ENV:Body> <APIResponse> <ClickFraudReport> <Name>Click Fraud Report</Name> <TimeRange>Thursday, November 23, 2006 - Wednesday, November 2 +9, 2006</TimeRange> <Campaigns> <Campaign> <Name>Google 140</Name> <Cost>$330.14</Cost> <LandingPage>/?source=29938</LandingPage> <Keywords>probability, stasticial analysis</Keywords> <Headline>Special Headline</Headline> <Criterion>http://www.mywebsite.com?source=29938</Criterio +n> <Sessions> <Number>230</Number> <TotalVisits>7733</TotalVisits> <Changed>0</Changed> <OldNumber>267</OldNumber> <OldTotalVisits>10249</OldTotalVisits> </Sessions> </Campaign> <Campaign> <Name>Google 28</Name> <Cost>$566.02</Cost> <LandingPage>/?source=29033</LandingPage> <Keywords>caution, long tail</Keywords> <Headline>Even Better Headline</Headline> <Criterion>http://www.mywebsite.com?source=29033</Criterio +n> <Sessions> <Number>837</Number> <TotalVisits>4599</TotalVisits> <Changed>0</Changed> <OldNumber>112</OldNumber> <OldTotalVisits>10883</OldTotalVisits> </Sessions> </Campaign> </Campaigns> </ClickFraudReport> </APIResponse> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to access elements that SOAP::Lite Returns
by rhesa (Vicar) on Nov 30, 2006 at 19:32 UTC | |
by Anonymous Monk on Dec 01, 2006 at 02:38 UTC | |
|
Re: How to access elements that SOAP::Lite Returns
by meetraz (Hermit) on Nov 30, 2006 at 19:21 UTC | |
|
Re: How to access elements that SOAP::Lite Returns
by Herkum (Parson) on Nov 30, 2006 at 19:24 UTC | |
|
Re: How to access elements that SOAP::Lite Returns
by meetraz (Hermit) on Nov 30, 2006 at 19:21 UTC |