Posted on 2010-01-12 09:30:15.444155-08 by mosslover
Apache Authentication Module SOAP::Lite Issues with a .Net Webservice
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 am having an issue getting the parameters into the webservice for .Net, however there are variables in the @params and they are the correct username and password. It is passing back a value, but it is not taking in the parameters correctly. I have checked all the other variables and I found this by adding a null check in the .Net Webservice. I even tried hard coding variables into the webservice and that did not work. If anyone has any suggestions thank you in advance.
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.