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

Hi,

Man, these guys need to beef up their documents :(

I've managed to get their webservice working for grabbing categories, but now I'm trying to get the content for a specific poster (so I can make a "detailed page"), but it never seems to work :/

I'm a bit of a newbie when it comes to SOAP - so I'm posting here, in case I've missed anything stupid :/

The code I have it:

sub SendSOAPDetailedPoster { my $sendxml = qq| <APC_Search_Query> <WebSiteID>$ALLPOSTERSID</WebSiteID> <SearchTerm>5024381</SearchTerm> <LanguageID>3</LanguageID> </APC_Search_Query> |; my $query = <<CONTENT <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" x +mlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schema +s.xmlsoap.org/soap/envelope/"> <soap:Body> <GetProductByProductNumberInformation xmlns="http://Webservice.Allposters.com/APCF.AffiliateWebService/Produ +ctInformationService"> <APCSearchXml> <![CDATA[$sendxml]]> </APCSearchXml> </GetProductInformation> </soap:Body> </soap:Envelope> CONTENT ; print "QUERY: $query"; my $ua = LWP::UserAgent->new(); my $request = HTTP::Request->new(POST => 'http://webservice.allpos +ters.com/ProductInformationService.asmx'); # "http://Webservice.Allposters.com +/APCF.AffiliateWebService/ProductInformationService/GetProductByProdu +ctNumberInformation" $request->header(SOAPAction => '"http://Webservice.Allposters.com/ +APCF.AffiliateWebService/ProductInformationService/GetProductByProduc +tNumberInformation"'); $request->content($query); $request->content_type("text/xml; charset=utf-8"); my $response = $ua->request($request); if ($response->is_success) { my $content = $response->content; $content =~ s/&lt;/</sig; $content =~ s/&gt;/>/sig; my $refs = XMLin($content); my $results = $refs->{"soap:Body"}->{GetProductInformationResp +onse}->{GetProductInformationResult}->{APC_Search_Results}->{Search_R +esult}; #print Dumper($refs->{"soap:Body"}->{GetProductInformationResponse}->{ +GetProductInformationResult}->{APC_Search_Results}); my $products = $results->{Products}->{ProductInformation}; my $per_page = $results->{No_Of_Products_In_Current_Page}; my $num_results = $results->{Total_No_Of_Products}; my $current_page = $results->{Current_PageNumber}; my $num_pages; if ($num_results > 0) { $num_pages = ceil($num_results / $per_page); } else { $num_pages = 0; } $num_results = DatafeedSQL::commify($num_results); use Data::Dumper; print Dumper($products); return ($per_page,$num_results,$current_page,$num_pages,$produ +cts); } else { print "ERROR: " . $response->status_line; } }


Their documents are here:
http://webservice.allposters.com

The bit I'm trying to get working is "Product By Product Number"

Can anyone see my mess up, or point me in the right direction?



I've emailed AllPosters about it, but am not holding up much hope for a reply (took a week for them to reply to my last email :/)

TIA

Andy

Replies are listed 'Best First'.
Re: Anyone got the AllPosters SOAP webservice working?
by Anonymous Monk on Mar 10, 2010 at 04:36 UTC
    Any reason you're not using SOAP::Lite?
    $content =~ s/&lt;/</sig; $content =~ s/&gt;/>/sig;
    That makes no sense, esp if they are claiming SOAP