SOAP::Lite - getting WSDL using basic authentication

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm trying to find "the" method, using SOAP::Lite or SOAP::Schema,
to get a WSDL that requires HTTP authentication.

The only way I've been able to get a WSDL that requires basic
authentication is by over-riding the SOAP::Schema::access method:


use SOAP::Lite;

my $login = 'mylogin';
my $pw = 'mypassword';

my $service = SOAP::Lite
    -> service( ' ' );

# over-ride method to handle authentication
sub SOAP::Schema::access
   my $self = shift->new;
   my $url = shift || $self->schema_url || Carp::croak 'Nothing to
access. URL is not specified';

   my $req = HTTP::Request->new(GET => $url);

  # this is why it's over-ridden
  $req->authorization_basic($login, $pw);

   my $resp = $self->useragent->request($req);
   $resp->is_success ? $resp->content : die "Service description '$url'
can't be loaded: ",  $resp->status_line, "\n";

# and get_basic_credentials for the service calls,
# if they require authentication
sub SOAP::Transport::HTTP::Client::get_basic_credentials
     return $login => $pw;

In the Changelog for SOAP::Lite it shows:

0.65-beta2 Mon Oct 25 2004
   + Added SOAP::Schema->useragent - which returns the LWP::UserAgent
   instance that will be used when accessing WSDLs via the
   SOAP::Lite->service call. This is helpful when access to a WSDL
   requires authentication, etc.

Using S::S->useragent() and the additional LWP methods for
authentication, I can GET the WDSL, however I don't see how that
can be used in SOAP::Schema and by SOAP::Lite without over-riding
the access method. Over-riding it does work, but I'm looking for
how it should be done.

Re: SOAP::Lite - getting WSDL using basic authentication

Quoted text here. Click to load it

I appreciate that WDSL and SOAP are not the same thing, but the following
may help.
I've cut and pasted from our site.

sub new {
 # constructor always called new
 my $type=shift;
 my $self={};
 $self->=' ';
 $self->=' ';
 return bless $self,$type


sub connect_Server {
 my $self=shift; # grab the 'self' pointer to this object
 use Compress::Zlib;
 use SOAP::Lite +trace => 'debug';
 sub SOAP::Transport::HTTP::Client::get_basic_credentials
 {return $self-> => $self->}


Site Timeline