Reputation: 163
When I run my perl script (version: 5.6.1), I got below error: Can't find namespace for method(16:method) my code was:
my $ws_url = '$url';
my $ws_uri = '$uri';
my $ws_xmlns = '$xmlns';
my $soap = SOAP::Lite
-> uri($ws_uri)
-> on_action( sub { join '/s/', $ws_uri, $_[1] } )
-> proxy($ws_url);
my $method = SOAP::Data->name('Add')
->attr({xmlns => $ws_xmlns});
my @params = ( SOAP::Data->name(addParam => $myParam));
$response = $soap->call($method => @params);
then I read documentation in link: http://docs.activestate.com/activeperl/5.8/lib/SOAP/Lite.html, which says:
Be warned, that though you have more control using this method, you should specify namespace attribute for method explicitely, even if you made uri() call earlier. So, if you have to have namespace on method element, instead of: print SOAP::Lite -> new(....) -> uri('mynamespace') # will be ignored -> call(SOAP::Data->name('method') => @parameters) -> result; do print SOAP::Lite -> new(....) -> call(SOAP::Data->name('method')->attr({xmlns => 'mynamespace'}) => @parameters) -> result; ………. ………. Moreover, it'll become fatal error if you try to call it with prefixed name: print SOAP::Lite -> new(....) -> uri('mynamespace') # will be ignored -> call(SOAP::Data->name('a:method') => @parameters) -> result; gives you: Can't find namespace for method (a:method) because nothing is associated with prefix 'a'.
So, I tried change my code to:
my $soap = SOAP::Lite
-> on_action( sub { join '/s/', $ws_uri, $_[1] } )
-> proxy($ws_url);
my @params = ( SOAP::Data->name(addParam => $myParam));
my $response = $soap->call(SOAP::Data->name('Add')->attr({xmlns => $ws_xmlns}) => @params)
->result;
and it still did not work.. any advice?
thanks ahead!
Upvotes: 0
Views: 539
Reputation: 13942
SOAP::Lite uses Scalar::Util. Scalar::Util has XS (ie, compiled C, non-pure-Perl) code in it.
The Perl version you are running with is 5.6.1.
The documentation link you provided points to an ActiveState library for Perl version 5.8.0. I'm going to assume that the version of SOAP::Lite you installed was compiled for use with 5.8.0, since that's the documentation version you cited.
Perl version 5.8.0 is not binary compatible with Perl 5.6.1. Modules compiled for 5.6.1 that contain XS will not run under 5.8.0. Modules compiled for 5.8.0 that contain XS code will not run under 5.6.1. In your case, it's not the module SOAP::Lite that contains the XS code, but one of its dependencies: Scalar::Util.
When you installed SOAP::Lite from the ActiveState repository for 5.8.0, PPM updated all of the module's dependencies, including Scalar::Util. In so doing, it installed a version of Scalar::Util that is not binary compatible with Perl 5.6.1.
The error you're experiencing is sufficiently wonky to support this theory, in the absence of a better one. Seems like the easiest way out of the mess would be to upgrade Perl, as well as your installed modules, and hope it doesn't break something else. ;)
Upvotes: 1