Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

SOAP::Lite - 401 Unauthorized

by skunix (Novice)
on Jul 23, 2013 at 19:45 UTC ( #1045943=perlquestion: print w/replies, xml ) Need Help??
skunix has asked for the wisdom of the Perl Monks concerning the following question:

I'm not sure why the syntax below doesn't work but to fix it I put the username and password in the proxy URL like so...


I am trying to use SOAP::Lite to connect to a SOAP api that requires HTTP auth but I can't seem to get it to work and I have no idea how to debug this!

This is what I'm trying to do...

#!/usr/bin/perl use strict; use SOAP::Lite; my $soap = SOAP::Lite->new( proxy => [ 'https://<host>:<port>/<path>', 'credentails' => [ '<host>:<port>', # host:port 'My Realm', # realm 'username', 'password' ] ] ); my $som = $soap->RetrieveList(); die $som->faultstring if ($som->fault); print $som->results, "\n";

This is what I get for output...

401 Unauthorized at line 25.

The documentation, if you can call it that, for SOAP::Lite has been of no help. Anyone know what I am doing wrong?

$~=$^++;_:$~^=$^ ^=$~^=$^;$_.=($~=$~+$^.$/);($~<$$)?goto _:print

Replies are listed 'Best First'.
Re: SOAP::Lite - 401 Unauthorized
by poj (Monsignor) on Jul 23, 2013 at 20:47 UTC
    Try 'credentials' not 'credentails'.

      Darn my dyslexia, still having the same issue but at least that's fixed!

      $~=$^++;_:$~^=$^ ^=$~^=$^;$_.=($~=$~+$^.$/);($~<$$)?goto _:print
Re: SOAP::Lite - 401 Unauthorized
by Loops (Curate) on Jul 23, 2013 at 19:57 UTC

    If you have access to the server logs they'll likely reveal what the failure is. Short of that, you can inspect what is actually going out over the wire by tracing transport events using SOAP::Trace.

Re: SOAP::Lite - 401 Unauthorized
by vsespb (Chaplain) on Jul 23, 2013 at 23:36 UTC
    Today new version of SOAP::Lite released

    so possible it introduced new bug (and you use new version), either it fixed old bug (and you use old version)

      I am using the latest version. I tried installing version 0.716, no luck.

      $~=$^++;_:$~^=$^ ^=$~^=$^;$_.=($~=$~+$^.$/);($~<$$)?goto _:print

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1045943]
Approved by hdb
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2018-06-22 23:21 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (124 votes). Check out past polls.