w.k
w.k

Reputation: 8376

Perl: how to fix SOAP::Lite delcampe-api-client example?

Here http://code.google.com/p/delcampe-api-client/wiki/Info#Perl is code example of delcampe-api-client in Perl. Obviously, there is an syntax error, running the code i got:

syntax error at test.pl line 9, near "-> service"
Bareword "SOAP::Lite" not allowed while "strict subs" in use at test.pl line 8.
Execution of test.pl aborted due to compilation errors.

If i change code to little bit more meaningful for me, like this:

#!/usr/bin/perl

use SOAP::Lite;
use SOAP::WSDL;
use strict;
use warnings;

my $service = new SOAP::Lite;
print $service
    ->uri('http://api.delcampe.net/soap.php?wsdl')
    ->getServerTime()
    ->result;

I got:

A service address has not been specified either by using SOAP::Lite->proxy() or a service description)

What is wrong with this code? What proxy? Service description?

[ If you think, i have no experience with SOAP, you are certainly right. Still, how to get this little example to work. PHP example worked nicely, but not the Perl's one. ]

Upvotes: 1

Views: 1738

Answers (1)

Alien Life Form
Alien Life Form

Reputation: 1944

If I were you, I would give "The Fine Documentation" a try. This should work, however:

#!/usr/bin/perl

use SOAP::Lite;
use SOAP::WSDL;
use strict;
use warnings;

my $service = SOAP::Lite->service('http://api.delcampe.net/soap.php?wsdl');

print $service->getServerTime()->result;

Edit:

Documentation can be found at http://guide.soaplite.com/ - also perldoc SOAP::Lite from the command line.

The example (above) on the web site appears not to work on more than one count: this one, however, is tested and works on my machine:

#!/usr/bin/perl

use SOAP::Lite;
use strict;
use warnings;

my $service = SOAP::Lite->service('http://api.delcampe.net/soap.php?wsdl');

print $service->getServerTime();

Upvotes: 4

Related Questions