|
Posted by John on July 12, 2007, 1:41 pm
Please log in for more thread options
Hi
Back at my desk. Thanks. This is a different approach to the one I used a
while ago.
I need to look at this SOAP:WSDL as it appears to solve the problem although
I thought
Perl (and SOAP) had not developed a decent WSDL protocol but things must
have changed..
Thanks again. Much appreciated.
Regards
John
> John wrote:
>> Hi
>>
>> The following worked several years ago but not now.
>> Whatever ISBN I use I get -1.0 (No such number).
>> Just wondering whether the Barnes & Noble price check service is still
>> active?
>>
>> my $soap = SOAP::Lite
>> -> uri('urn:xmethods-BNPriceCheck')
>> -> proxy('http://services.xmethods.net:80/soap/servlet/rpcrouter');
>>
>> my $isbn='0465051359';
>> my $price=$soap->getPrice(SOAP::Data->type(string => $isbn));
>> print $price->result;
>>
> The test page is working:
>
> http://www.abundanttech.com/WebServices/bnprice/bnprice.asmx?op=GetBNQuote
>
> with the ISBN from
>
>
http://search.barnesandnoble.com/booksearch/isbnInquiry.asp?z=y&EAN=9780596002060&itm=3
>
> mark@owl:~$ cat barnesnoblepricesoap.pl
> use strict;
> use warnings;
>
> use constant URL =>
> q(http://www.abundanttech.com/webservices/bnprice/bnprice.wsdl);
> use constant SERVICENAME => q(BNPrice);
> use constant PORTNAME => q(BNPriceSoap);
> use constant OPERATIONNAME => q(GetBNQuote);
>
> use Data::Dumper;
> use SOAP::WSDL;
>
> my $isbn = shift;
> my $no_dispatch = shift;
>
> my $soap = SOAP::WSDL->new( wsdl => URL , no_dispatch => $no_dispatch);
>
> $soap->wsdlinit( caching => 1 , );
> $soap->on_action( sub { sprintf '"%s/%s"', shift || '', shift },
> );
>
> $soap->servicename(SERVICENAME);
> $soap->portname(PORTNAME);
>
> my %args =
> ( sISBN => $isbn );
> my $som = $soap->call(OPERATIONNAME , %args );
>
> if($som->fault){
> die $som->faultstring();
> }
>
> print $som->result()."\n";
>
> mark@owl:~$ perl barnesnoblepricesoap.pl 0596002068
> 39.95
> mark@owl:~$
>
> WSDL is your friend :)
>
> The on_action line is necessary (as far as I can tell) to get SOAP::Lite
> to work with a .NET web service.
>
> Mark
>
> Mark
|