SOAP::Lite - getting WSDL using basic authentication

J

J. Gleixner

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:

e.g.

use SOAP::Lite;

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

my $service = SOAP::Lite
-> service( 'http://some.server.com/some/protected/path/my.wsdl' );
#$service->some_method();

# 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,021
Latest member
AkilahJaim

Latest Threads

Top