【发布时间】:2016-07-23 05:22:53
【问题描述】:
Centos 5 | Perl 5.10.0 | SOAP::Lite 1.20
阅读了使用 on_fault 作为 SOAP::Lite 的默认错误处理的替代的文档后,我希望以下代码使用回调进行错误处理处理。但是,我看到正在使用默认值
#!/usr/bin/perl
use strict;
use SOAP::Lite;
my $log #calls to Log4Perl
my $soapServer = "http://somelocation/services/GdeWsOpenAPI?wsdl"
my $soap = new SOAP::Lite();
$soap->on_fault( \&soapError );
$soap->service($soapServer);
sub soapError {
my($soap, $res) = @_;
my $message = ref $res ? $res->faultstring : $soap->transport->status;
$log->write( "fatal connection error to server $SoapServer: $message.", 0);
print STDERR "connection error: $message\n";
exit 1;
}
输出是: 无法加载服务描述“http://somelocation/services/GdeWsOpenAPI?wsdl”:500 无法连接到某个位置:80
预期(由于传输错误): 连接错误:无法加载服务描述“http://somelocation/services/GdeWsOpenAPI?wsdl”:500 无法连接到某个位置:80
我错过了什么?
【问题讨论】: