How to integrate NTLM authentication with Perl SOAP :: Lite module?

This Perl code works with anonymous access to the ASP.NET web service, but when integrated protection is enabled, the service returns 401 errors. I think I need to use the NTLM module with SOAP :: Lite, but it’s not clear how to do this. How can these components be integrated?

use SOAP::Lite; use strict; my $proxy = "http://localhost:28606/WebService.asmx"; my $method_name = "HelloWorld"; my $uri = "http://tempuri.org/"; my $methodAction = $uri . $method_name; my $soap = SOAP::Lite ->uri( $uri ) ->proxy( $proxy ) ->on_action(sub{ $methodAction; }); my $method = SOAP::Data->name($method_name)->attr({xmlns=>$uri}); my $result = $soap->call($method); print $result->result(); 
+4
source share
2 answers

You can force SOAP :: Lite to print debug output if you do this:

 use SOAP::Lite +trace; 

instead

 use SOAP::Lite; 

EDIT:

OK, I think now I understand. Enabling the integrated security feature forces IIS to require NTLM authentication. There's a thread on perlmonks.org that seems to reveal the answer.

+2
source

I'm a little late, but I ran into the same problem. Try the following:

 use LWP::UserAgent; use LWP::Debug; use SOAP::Lite on_action => sub { "$_[0]$_[1]"; }; import SOAP::Data 'name', 'value'; our $sp_endpoint = 'http://sp.example.com/sites/mysite/_vti_bin/lists.asmx'; our $sp_domain = 'sp.example.com:80'; our $sp_username = 'DOMAIN\username'; our $sp_password = 'xyz'; if ($debug) { LWP::Debug::level('+'); SOAP::Lite->import(+trace => 'all'); } my @ua_args = (keep_alive => 1); my @credentials = ($sp_domain, "", $sp_usernam, $sp_password); my $schema_ua = LWP::UserAgent->new(@ua_args); $schema_ua->credentials(@credentials); $soap = SOAP::Lite->proxy($sp_endpoint, @ua_args, credentials => \@credentials); $soap->schema->useragent($schema_ua); $soap->uri("http://schemas.microsoft.com/sharepoint/soap/"); 
+1
source

Source: https://habr.com/ru/post/1286427/


All Articles