Subject: | invalid arg access in find_operation() causing 'undef error - no node' |
Hi,
I think I have identified a problem in
SOAP::WSDL::PortType::find_operation(), where the match arguments do not
get passed as expected to the call to List::Util::first(), causing the
subroutine to always return undef.
In the current version (2.00_10 in CPAN today) the call to
List::Util::first passes a block which in turn references $_[1] and
$_[2]. By the time these terms are evaluated their values are no longer
the same as they were when find_operation() was called.
The version of PortType.pm which I have attached seems to resolve the
problem, allowing code generation to proceed.
After the issue I'm reporting is fixed, another (similar-looking) fault
occurs when generating stub code from
https://provisioning.fetchtv.com.au/provisioning/ws/service.wsdl,
however this occurs for another reason which I'll report seperately.
I encountered the issue by executing this command:
wsdl2perl.pl -b .
https://provisioning.fetchtv.com.au/provisioning/ws/service.wsdl
.. after successfully creating complextypes and elements, the first
interface type fails to generate with this error:
Creating interface class
MyInterfaces/ProvisioningService/ProvisioningService.pm
/usr/local/share/perl/5.8.8/SOAP/WSDL/Generator/Template/XSD\Interface.t
t undef error - no node at
/usr/local/share/perl/5.8.8/SOAP/WSDL/Generator/Template/Plugin/XSD.pm
line 55
SOAP::WSDL::Generator::Template::Plugin::XSD::create_xsd_name('SOAP::WSD
L::Generator::Template::Plugin::XSD=SCALAR(0x8dde694)', '') called at
/usr/local/share/perl/5.8.8/SOAP/WSDL/Generator/Template/XSD/Interface/P
OD/Operation.tt line 5
...
I'm running perl v5.8.8 on Debian.
Subject: | PortType.pm |
package SOAP::WSDL::PortType;
use strict;
use warnings;
use Class::Std::Fast::Storable;
use List::Util;
use base qw(SOAP::WSDL::Base);
use version; our $VERSION = qv('2.00.10'); # altered TS 20110930
my %operation_of :ATTR(:name<operation> :default<()>);
#
#=head2 find_operation
#
#$port_type->find_operation($namespace, $name)
#
#Returns the PortType's operation object matching the given namespace and
#name
#
{ # fix: match block doesn't access $_[1] and $_[2] properly - provide lexical holders for match terms
my ($wanted_tns, $wanted_name);
sub find_operation {
($wanted_tns, $wanted_name) = @_[1,2];
return List::Util::first {
( $_->get_targetNamespace() eq $wanted_tns ) && ( $_->get_name() eq $wanted_name )
} @{ $operation_of{ ${ $_[0] } } };
}
};
1;