Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: NTLM Authentication with SOAP::Lite not working

by Anonymous Monk
on Oct 28, 2008 at 13:38 UTC ( #719995=note: print w/replies, xml ) Need Help??

in reply to NTLM Authentication with SOAP::Lite not working

LWP::Authen::Ntlm::authenticate: No username and password available from get_basic_credentials(). Returning unmodified response object
grep SOAP-Lite-0.710.08 credentials :
#!perl -w #!d:\perl\bin\perl.exe # -- SOAP::Lite -- -- Copyright (C) 2001 Paul Kulchenko - +- use SOAP::Lite +autodispatch => uri => '', proxy => 'http://localhost/', # proxy => 'http://localhost/cgi-bin/soap.cgi', # local CGI server # proxy => 'http://localhost/soap', # local mod_perl serve +r # proxy => 'https://localhost/soap', # local mod_perl SECUR +E server on_fault => sub { my($soap, $res) = @_; die ref $res ? $res->faultdetail : $soap->transport->status, "\n"; } ; sub SOAP::Transport::HTTP::Client::get_basic_credentials { return ('us +er' => 'password') }; print getStateName(1), "\n\n"; print getStateNames(12,24,26,13), "\n\n"; print getStateList([11,12,13,42])->[0], "\n\n"; print getStateStruct({item1 => 10, item2 => 4})->{item2}, "\n\n"; # OR if you have SOAP::Lite object you can do # $s->transport->credentials('host_port', 'realm', 'user' => 'password +'); # see LWP::UserAgent for difference and more documentation # OR add user and password to your URL as follows: # proxy => 'http://user:password@localhost/'

Replies are listed 'Best First'.
Re^2: NTLM Authentication with SOAP::Lite not working
by perlchild (Acolyte) on Oct 28, 2008 at 13:52 UTC

    Thank you so very much Anonymous Monk. I added that

    sub SOAP::Transport::HTTP::Client::get_basic_credentials { return ('user' => 'password') };

    line and now it works perfectly!! I gave you a positive vote. Thanks again!!!

      I'm not sure how overriding the get_basic_credentials method solves your problem, but it seems like a bad idea. You should read the LWP::Authen::Ntlm documentation, it includes a clear example of usage.

        Something like this should work
        use LWP::UserAgent; use LWP::Debug; use SOAP::Lite on_action => sub { "$_[0]$_[1]"; }; import SOAP::Data 'name', 'value'; our $sp_endpoint = ' +asmx'; our $sp_domain = ''; 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 => \@cre +dentials); $soap->schema->useragent($schema_ua); $soap->uri("");

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://719995]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-05-08 21:46 GMT
Find Nodes?
    Voting Booth?
    Perl 7 will be out ...

    Results (97 votes). Check out past polls.