这是我的第一个 Perl 脚本。我已经使用 CPAN 安装了 SOAP::Lite,它似乎一切正常。
我正在尝试访问一个简单的 HelloWorld .NET Web 服务。我收到一个似乎与 Perl 或 SOAP::Lite 无法验证 SSL 证书有关的错误。
虽然看起来它返回了 500 的代码,但我创建了一个能够很好地调用 Web 方法的 Java 客户端,所以我认为问题不在于 Web 服务端。
谁能指出我如何让这个工作正确的方向?
脚本:
#!/usr/bin/perl
use SOAP::Lite 'trace', 'debug';
$api_ns = "https://www.mydomain.com/edgedev/";
$api_url = "https://www.mydomain.com/edgedev/ws.asmx";
$action = "HelloWorld";
my $soap = SOAP::Lite
-> readable(1)
-> ns($api_ns, 'tns')
-> proxy($api_url)
-> on_action(sub { return "\"$action\""});
print $soap->HelloWorld()->result;
结果
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="https://www.mydomain.com/edgedev/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<tns:HelloWorld xsi:nil="true" />
</soap:Body>
</soap:Envelope>
SOAP::Transport::HTTP::Client::send_receive: 500 Can't connect to www.mydomain.com:443 (certificate verify failed)
Content-Type: text/plain
Client-Date: Tue, 12 Feb 2013 16:40:28 GMT
Client-Warning: Internal response
Can't connect to www.mydomain.com:443 (certificate verify failed)
You can disable hostname check by setting environment variable PERL_LWP_SSL_VERIFY_HOSTNAME=0
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown errorerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed at /usr/lib/perl5/vendor_perl/5.10.0/LWP/Protocol/http.pm line 57.
500 Can't connect to www.mydomain.com:443 (certificate verify failed) at ./soaptest.pl line 15