Stetec has asked for the wisdom of the Perl Monks concerning the following question:
But this code is usgin SOAP::WSDL and I cannot get it right - I always get error from server: "401 - Unauthorized: Access is denied due to invalid credentials". When I post the request with Curl from command line everything works. The server administrator told me that from logs it seems like I am not providing credentials. So far I have this:BEGIN { sub SOAP::Transport::HTTP::Client::get_basic_credentials { return 'username' => 'password'; } }
AccMgrWSSoap is a class that inherits from SOAP::WSDL::Client::Base and GetSometing looks like this:$service = MyInterfaces::AccMgrWS::AccMgrWSSoap->new({proxy => [$url, +keep_alive => 1]}); my @headers = ( SOAP::Header->name('username')->value($user), SOAP::Header->name('password')->value($pass), ); my $result = $service->GetSometing(undef, \@headers);
Any ideas how can I make this work? Thank yousub GetSometing { my ($self, $body, $header) = @_; die "GetSometing must be called as object method (\$self is <$self +>)" if not blessed($self); return $self->SUPER::call({ operation => 'GetSometing', soap_action => 'http://www.some.address/GetSometing', style => 'document', body => { 'use' => 'literal', namespace => 'http://schemas.xmlsoap.org/wsdl/soap/' +, encodingStyle => '', parts => [qw( MyElements::GetSometing )], }, header => { }, headerfault => { } }, $body, $header); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: SOAP::WSDL authentication
by thanos1983 (Parson) on Mar 14, 2018 at 10:35 UTC | |
by Stetec (Novice) on Mar 27, 2018 at 13:41 UTC |