in reply to SOAP::Lite? Erm, what the (censored) is the $som->result supposed to return?
If you look at the WSDL you will see that the response message is defined like:
The problem with this is that the actual payload is therefore the <s:any /> - that is to say the designers punted on the definition and opted to say "we're going to return some XML of some sort" - it appears from the XML below that this is being generated from another system and not by the .NET serialization. This is not very useful and the stub created by stubmaker.pl is not going to deal with it well as it stands. Because this is an ASP.NET web service one is able to access it, for nstance, via an HTTP GET - you can see that it returns something like:<s:element name="GetMarketClassifiersResponse"> <s:complexType> <s:sequence> <s:element minOccurs="0" maxOccurs="1" name="GetMarketClas +sifiersResult"> <s:complexType mixed="true"> <s:sequence> <s:any /> </s:sequence> </s:complexType> </s:element> </s:sequence> </s:complexType> </s:element>
(I've removed most of the records for clarity.)<SpecificClassification xmlns="http://seek.com.au/SpecificClassificati +on.xsd"> <list id="list-1" value="Location" multiSelect="false"> <listItem id="listItem-1000" value="Sydney" linking="listItem-2819 + listItem-2820 listItem-2821 listItem-2822 listItem-2835 listItem-283 +6 " legacyID="listItem-1000"> </listItem> </list> </SpecificClassification>
You could quite easily use LWP::UserAgent to retrieve the data as above and the use (e.g.) XML::Simple to access the data or you should be able to use SOAP::SOM directly, however there appears to be a bug somewhere that is stopping it from getting at the attributes, so I think that you probably want to use my first suggestion until it gets fixed.
You can access the attributes odf the listItem elements with something like:
- it's just a matter of finding the right combination of SOAP::SOM and SOAP::Data munging.use SOAP::Lite ; + my $client = SOAP::Lite ->readable(1) ->uri('http://webservices.seek.com.au') ->autotype(0) ->on_action(sub { join '/', @_ }) ->proxy('http://webservices.seek.com.au/marketsegment.a +smx'); $som = $client->GetMarketClassifiers(SOAP::Data->name('mark +etSegment','Main')->uri('http://webservices.seek.com.au')); + my $foo = $som->match('//GetMarketClassifiersResponse/SpecificClassifi +cation/list/'); + foreach my $item ($foo->dataof('//listItem/')) { print $item->attr->{id},"\n"; }
update: It appears the bug was in my brain.
/J\
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: SOAP::Lite? Erm, what the (censored) is the $som->result supposed to return?
by Jenda (Abbot) on Apr 27, 2005 at 14:58 UTC |