Perl:如何修复 SOAP::Lite delcampe-api-client 示例?
这里 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我是你,我会尝试“The Fine Documentation”。不过,这应该可行:
编辑:
可以在 http://guide.soaplite 找到文档。 com/ - 也可以从命令行使用 perldoc SOAP::Lite。
网站上的示例(上面)似乎无法在多种情况下运行:但是,这个示例已经过测试并且可以在我的机器上运行:
If I were you, I would give "The Fine Documentation" a try. This should work, however:
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: