我有一個問題,使用Perl傳遞一個字符串參數。下面的代碼肥皂精簡傳遞字符串參數
#!/usr/bin/perl -w
use SOAP::Lite;
my $service = SOAP::Lite->service('http://localhost:8080/greeting?wsdl');
print $service->greetClient('perl wooooo'), "\n";
結果
問候空!有一個愉快的一天......
類似的Python代碼
from suds.client import Client
client = Client('http://localhost:8080/greeting?wsdl')
print client.service.greetClient('python wooooo')
作品完美
問候蟒蛇WOOOOO!有一個愉快的一天......
我試圖設置不同的編碼
print $service->encoding('utf-8')->greetClient("perl wooooo"), "\n";
具有相同的結果。
一個SOAP監視器顯示有在Perl
<greetClient xsi:nil="true" xsi:type="tns:greetClient" />
的情況下,沒有爲arg0這是目前在Python
<ns0:greetClient>
<arg0>python wooooo</arg0>
</ns0:greetClient>
的情況下,可以採取什麼問題嗎?
爲什麼使用Perl與Python相比實現SOAP客戶端如此複雜?
編輯: SOLUTION
最後下面的解決方案正在
#!/usr/bin/perl -w
use strict;
use warnings;
use XML::Compile::SOAP11;
use XML::Compile::WSDL11;
use XML::Compile::Transport::SOAPHTTP;
my $soap = XML::Compile::WSDL11->new('c:/temp/greeting.wsdl');
my $call = $soap->compileClient('greetClient');
print $call->(arg0 => 'perl wooooo'){'greetClientResponse'}{'return'}, "\n";
感謝您的回答。我不是Perl專家。我在這裏找到了SOAP :: WSDL http://search.cpan.org/~mkutter/SOAP-WSDL-2.00.10/。我該如何安裝它? ppm不顯示在列表中? –
我正在使用Windows和Perl Build.PL不工作,因爲它尋找gcc和其他東西。理想情況下,我想像我對SOAP:Lite使用ppm一樣安裝包。 –
對不起,只是藉此機會發佈'SOAP :: Lite'。也許'SOAP :: WSDL'不適用於ActivePerl。你看到'XML :: Compile :: SOAP'嗎?如果有的話,我會更新我的答案。 –