Thread

Posted on Tue Jan 16 05:09:08 2007 by yanijc
Can't call method name at SOAP Lite.pm line 2980.
I inherited some old code that uses SOAP::Lite. Recently the code was proactivly moved to a different, newer, server. The new server has SOAP::Lite 0.67 installed, the older one was using 0.60-1. My code is now getting to MyLib.pm line 88 which is:
my $service = SOAP::Lite->service($url);
then dying with: Can't call method "name" without a package or object reference at /usr/lib/perl5/site_perl/5.6.2/SO +AP/Lite.pm line 2980. SOAP::Schema::generate_stub('SOAP::Schema=HASH(0xe12294c)', 'ReportService') called at /usr/lib/pe +rl5/site_perl/5.6.2/SOAP/Lite.pm line 2939 SOAP::Schema::load('SOAP::Schema=HASH(0xe12294c)') called at /usr/lib/perl5/site_perl/5.6.2/SOAP/L +ite.pm line 3335 SOAP::Lite::service('SOAP::Lite', '<$url_removed>') called at MyLib.pm line 88
Has the proper syntax changed since 2003? What should I be doing differently? any pointers? thanks, Yani
Direct Responses: 4043 | Write a response
Posted on Tue Jan 16 08:30:10 2007 by saramic in response to 4039
Re: Can't call method name at SOAP Lite.pm line 2980.
not a super user of SOAP::Lite but I will try to help
SOAP::Lite 0.60 http://search.cpan.org/src/BYRNE/SOAP-Lite-0.60a/lib/SOAP/Lite.pm
sub stub { my $self = shift->new; my $package = shift; my $services = $self->services->{$package}; my $schema = $self->schema; .... map(" SOAP::Data->new(name => '" . $_->name . "', type => '" . $_->type . "', attr => {" . do{ my %attr = %{$_->attr}; join ', ', map {"'$_' => '$ +attr{$_}'"} grep {/^xmlns:(?!-)/} keys %attr} . "}),", @{$services->{$service}{parameters}}), " ],\n },", ), ....
SOAP::Lite 0.67 http://search.cpan.org/src/BYRNE/SOAP-Lite-0.67/lib/SOAP/Lite.pm
line 2980 is $self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."', type => '".$_->type."', attr => {";
sub generate_stub { my $self = shift->new; my $package = shift; my $services = $self->services->{$package}; my $schema_url = $self->schema_url; .... foreach (@{$services->{$service}{parameters}}) { # next unless $_; $self->{'_stub'} .= " SOAP::Data->new(name => '".$_->name."', type => '".$_->type."', at +tr => {"; $self->{'_stub'} .= do { my %attr = %{$_->attr}; join(', ', map {"'$_' => '$attr{$_}'"} grep {/^xmlns:(?!-)/} keys %attr) }; $self->{'_stub'} .= "}),\n";

so both go over the array
@{$services->{$service}{parameters}}
it is just that the old version used map which would automaticaly skip over null values while the newer version (and current 0.69) do not skip over null values (but note the next unless $_; code is there it is just not used). I presume this is to make sure that all parameters are valid/exist etc. so something to do with named parameters I guess but I would need to look more closely at other output. if I remember correctly your $url is the WSDL url, can you upload a section of the WSDL to see if it is correct? is it right on that line that if fails or is it what you call the service you create with something like
$service->call('fetchBankBalance' => 'Larry Wall');

cheers Saramic
Direct Responses: 4054 | Write a response
Posted on Tue Jan 16 21:44:29 2007 by yanijc in response to 4043
Re: Can't call method name at SOAP Lite.pm line 2980.
Yeah, I was looking at the code diffs, and noticed the
# next unless $_;
on line 2979, and just tried uncommenting it. Like that, it fails with:
SOAP Fault: The request xml was invalid. for input "" (Error Code ) at /usr/lib/perl5/site_perl/5.6 +.2/SOAP/Lite.pm line 3387
(and it doesn't croak, so I'm getting that for every request my code is trying to send)

So I guess it needs that parameter to send a proper request, so I'm back to trying to figure out what it wants to be fed. I'll post back here if I get it figured out.

And, yes, with that line commented out (the way it was orig), it fails on
my $service = SOAP::Lite->service($url);
With it uncommeted it gets farther down to what it's supposed to be sending, and I get the 'invalid XML' error when it tries to call:
return $service->scheduleReportJob(@data, @headers);

As for the WSDL, it's probably valid, it was working before our hardware swap. I've been using that one since, um, the beginning of December, I think. When they change it, they incremement the version number in the url. It is https if that makes a difference. The https makes the w3c validator not be able to examine it.
Direct Responses: 4083 | Write a response
Posted on Fri Jan 19 00:41:40 2007 by yanijc in response to 4054
Re: Can't call method name at SOAP Lite.pm line 2980.
Well, I ended up not finding the answer to this.
We ended up installing the older 0.60 version on the server, and now it runs just fine again. Woe betide any other programer here who wants to use this module on this server for something else and needs an up to date version.
Direct Responses: 6839 | Write a response
Posted on Wed Jan 9 21:23:45 2008 by brahmos in response to 4083
Re: Can't call method name at SOAP Lite.pm line 2980.
The older 0.60 version worked for me too. Thanx for the tip.
Write a response