Perl:如何修复 SOAP::Lite delcampe-api-client 示例?

发布于 2025-01-01 18:27:38 字数 959 浏览 0 评论 0原文

这里 http://code.google.com/p/delcampe- api-client/wiki/Info#Perl 是 Perl 中 delcampe-api-client 的代码示例。显然,存在语法错误,运行我得到的代码:

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.

如果我将代码更改为对我来说更有意义,如下所示:

#!/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;

我得到:

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

这段代码有什么问题?什么代理?服务描述?

[ 如果您认为我没有 SOAP 经验,那么您当然是对的。不过,如何让这个小例子发挥作用。 PHP 示例运行良好,但 Perl 示例则不然。 ]

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. ]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泅渡 2025-01-08 18:27:38

如果我是你,我会尝试“The Fine Documentation”。不过,这应该可行:

#!/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;

编辑:

可以在 http://guide.soaplite 找到文档。 com/ - 也可以从命令行使用 perldoc SOAP::Lite。

网站上的示例(上面)似乎无法在多种情况下运行:但是,这个示例已经过测试并且可以在我的机器上运行:

#!/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();

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();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文