Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: soap::lite and authorization

by fritz1968 (Sexton)
on Aug 29, 2012 at 14:26 UTC ( #990481=note: print w/replies, xml ) Need Help??


in reply to Re: soap::lite and authorization
in thread soap::lite and authorization

ok. I have attempted to put in this piece of code. Here is what I tried:
my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } ) ->proxy($args->{proxy}); my $response = $lite->call( SOAP::Data->name('fetchAndLock') ->attr({ 'xmlns', $args->{xmlns}}), SOAP::Data->name("first")->value($args->{first}), SOAP::Data->name("max")->value($args->{max}), SOAP::Data->name("action")->value($args->action}), SOAP::Data->name("state")->value($args->{state}), ); return $response; } sub SOAP::Transport::HTTP::Client::get_basic_credentials { $zID => $zPW; }

Where $zID and $zPW were defined higher up in the code. When I run the script, I receive the following error:

SOAP::Transport::HTTP::Client::send_receive: HTTP/1.1 401
Unauthorized
Connection: close
Date: Wed, 29 Aug 2012 14:16:22 GMT
Server: IBM_HTTP_Server
Content-Language: en-US
Content-Type: text/xml; charset=UTF-8
Client-Date: Wed, 29 Aug 2012 14:16:22 GMT
Client-Peer: 169.81.175.20:80
Client-Response-Num: 1
Client-Transfer-Encoding: chunked
Client-Warning: Missing Authenticate header


I tried putting the "get_basic_credentials" line just after the "my $line = SOAP..." line, but the error is the same.

where am I going wrong? Any help/advice/suggestions/etc... are much appreciated.

Thanks
Frank

Replies are listed 'Best First'.
Re^3: soap::lite and authorization
by Anonymous Monk on Aug 30, 2012 at 11:37 UTC

    where am I going wrong? Any help/advice/suggestions/etc... are much appreciated.

    At I suspect you provided a base64 encoded password, but transport.... takes care of any required encoding

      I figured it out. Adding in a header in the correct spot made all the difference:

      my $lite = SOAP::Lite->new()->on_action(sub { join '/', @_ } ) ->proxy($args->{proxy}), SOAP::Header->name('Authentication' => SOAP::Header->value( SOAP::Header->name('user')->value($zID), SOAP::Header->name('password')->value($zPW))); my $response = $lite->call( SOAP::Data->name('fetchAndLock') ->attr({ 'xmlns', $args->{xmlns}}), SOAP::Data->name("first")->value($args->{first}), SOAP::Data->name("max")->value($args->{max}), SOAP::Data->name("provider")->value($args->{provider}), SOAP::Data->name("action")->value($args->{action}), SOAP::Data->name("state")->value($args->{state}), );

        I figured it out. Adding in a header in the correct spot made all the difference:

        LOL, that is crazy, there is no way to guess at that

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990481]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2018-08-16 02:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Asked to put a square peg in a round hole, I would:









    Results (166 votes). Check out past polls.

    Notices?