Here is my code:
package Apache2::AuthGetUser; #authenticates users based on bool value from a asmx webservice
use SOAP::Lite;
use Data::Dumper;
use strict;
use warnings;
use Apache2::Access();
use Apache2::RequestRec();
use Apache2::Const ':common';
use Apache2::Log;
sub handler {
my $r = shift;
my ($status, $password) = $r->get_basic_auth_pw;
return $status unless $status == Apache2::Const::OK;
my $username = $r->user('user');
my $endpoint = "http://mosslover/_layouts/wsfbaauthentication.asmx"; #endpoint
my $namespace = "http://tempuri.org"; #namespace
my $wsfunction = "AuthenticateUser"; #webservice function
my $webservice = SOAP::Lite
->uri($namespace)
->on_action(sub { join '/', $namespace, $_[1] })
->proxy($endpoint);
my $method = SOAP::Data->name($wsfunction)
->attr({xmlns => $namespace});
my $userParam = SOAP::Data->name(UserName => $username)->type('xsd:string');
my $passwordParam = SOAP::Data->name(Password => $password)->type('xsd:string');
my @params = ($userParam, $passwordParam);
my $result = $webservice->call($method=>@params)->result;
$r->log_error($result);
if($result ne "true"){
$r->note_basic_auth_failure;
#$r->log_err($result);
return AUTH_REQUIRED;
}
return Apache2::Const::OK;
}
1;
I have tested the code to check all the parameters. The UserName and Password are there. The parameters have the correct values, but when I pass in the values to the .Net Webservice the Username and Password are lost. Is there a syntax error or something else I need to be aware of to get .Net to work with Soap::Lite? It actually returns a value from the webservice, so it's just one piece that is not working. Any help would be grateful.