Greetings esteemed Monks!
I am writing a small bit of SOAP client code using SOAP::Lite though this is not necessarily a SOAP question. I wrote a small subroutine to make life easier for the .NET eccentricities when using SOAP::Lite. When I uncomment the commented lines below and comment the next two it works fine. However when I run it as below it fails. I can't see the difference. Is it something with references?
use SOAP::Lite;
use strict;
my $uri = "test_uri;
my $proxy = "test_proxy";
my $service = SOAP::Lite
->uri($uri)
->proxy($proxy)
->on_action(sub{sprintf '%s/%s', @_ });
my $uname = "testuser";
my $pwd = "testpwd";
#my $username = SOAP::Data->name(username => $uname)->type('string')->
+uri($uri);
#my $password = SOAP::Data->name(password => $pwd)->type('string')->ur
+i($uri);
my $username = dotnet_stuff("username", $uname);
my $password = dotnet_stuff("password", $pwd);
my $test = $service->Login($username, $password);
print $test->result();
if($test->fault()) {
my $error = join (', ', $test->faultcode, $test->faultstring);
print "$error";
}
sub dotnet_stuff {
my $name = pop(@_);
my $value = pop(@_);
my $soap = SOAP::Data->name($name => $value)->type('string')->uri($
+uri);
return $soap;
}
Any help would be appreciated very much!