SOAP::Lite - getting WSDL using basic authentication

Discussion in 'Perl Misc' started by J. Gleixner, Feb 12, 2008.

  1. J. Gleixner

    J. Gleixner Guest

    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.
    J. Gleixner, Feb 12, 2008
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Aaron Brady

    SQL, lite lite lite

    Aaron Brady, Dec 29, 2008, in forum: Python
    Replies:
    15
    Views:
    736
    Aaron Brady
    Jan 1, 2009
  2. Andrew Tkachenko

    SOAP::Lite +wsdl

    Andrew Tkachenko, Mar 5, 2005, in forum: Perl Misc
    Replies:
    0
    Views:
    143
    Andrew Tkachenko
    Mar 5, 2005
  3. spacegoat
    Replies:
    2
    Views:
    167
    spacegoat
    Nov 6, 2005
  4. ashgromnies
    Replies:
    0
    Views:
    190
    ashgromnies
    Apr 24, 2006
  5. John Bokma

    SOAP::Lite + wsdl misunderstanding?

    John Bokma, Jan 24, 2007, in forum: Perl Misc
    Replies:
    0
    Views:
    118
    John Bokma
    Jan 24, 2007
Loading...

Share This Page