Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks, I got to write a Perl client to access a customers web services. They gave me a link to their wsdl file so I dusted off SOAP::Lite and ran the stubmaker.pl utility to create the class from the wsdl file. So far so good, wrote a simple harness and it failed, authorisation required. After a search I added this line to the stub class
sub SOAP::Transport::HTTP::Client::get_basic_credentials { return ('do +main\user' => 'password') };
Re-ran the test harness
#!/usr/bin/perl use lib "./modules/"; use Discovery; use strict; use warnings; my $c = Discovery->new(); print $c->GetSources;
This got further but still failed...
... ... ... The keep_alive option must be enabled for NTLM authentication to work. + NTLM authentication aborted. SOAP::Transport::HTTP::Client::send_receive: HTTP::Response=HASH(0x285 +8510) SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 401 Unauthorized Connection: close ... ... ... 401 Unauthorized at ./testit.pl line 11. ...
Has anyone managed to get wsdl working using SOAP::Lite and NTML I've no idea how to enable keep_alive in the code created by stubmaker.pl

Replies are listed 'Best First'.
Re: SOAP::Lite keep alive and NTLM stubmaker.pl issue
by Corion (Patriarch) on Aug 25, 2017 at 13:01 UTC

    When/whereever you create the SOAP::Lite instance, you need to create it with the keep_alive option set to a true value:

    my $soap = SOAP::Lite->new( proxy => [ $url, keep_alive => 1, ], ... );

    I don't know if the stubmaker script creates sensible code. Most likely you will need to monkeypatch the subroutine like you did with get_basic_credentials already.