2012-02-01 48 views
1

這裏http://code.google.com/p/delcampe-api-client/wiki/Info#Perl是Perl中delcampe-api-client的代碼示例。很顯然,有一個語法錯誤,運行我得到了代碼:Perl:如何解決SOAP :: Lite 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的。 ]

回答

4

如果我是你,我會試試「精細文檔」。在命令行也的perldoc SOAP ::精簡版 -

文檔可以在http://guide.soaplite.com/發現:這應該工作,但是:

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

編輯。

網站上的例子(上圖)好像不工作多於一個數:這一個,然而,測試和工程在我的機器上:

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

也許它應該,但它不。你可以指點我的文檔你的意思。 – 2012-02-01 17:08:47

+0

查看我的編輯,高於 – 2012-02-01 18:03:12

+1

從腳本中丟棄SOAP :: WSDL,這是處理WSDL的示例似乎不是一種解決方案;( – 2012-02-01 22:06:55

相關問題