Thread

Posted on Sun Mar 9 06:19:21 2008 by jrupard
Basic Auth Issue SOAP-WSDL-2.00_32
I'm having an issue with basic authentication and SOAP-WSDL-2.00_32. The transport is not sending the WWW-Authenticate header (or a correct one)..

The following code returns a 401 error in $result;
use warnings; use lib 'wsdl-lib/'; use MyInterfaces::DOperations::DOperationsSoap; my $user ='xxxx'; my $password = 'yyy'; *SOAP::Transport::HTTP::get_basic_credentials = sub { return ($user, $password); }; my $dws = MyInterfaces::DOperations::DOperationsSoap->new(); my $result = $dws->Enum({ server => { Ip => '192.168.0.2'}}); die $result->get_faultstring()->get_value() if not ($result);

I'm using similar code with a SOAP::Lite client using basic auth, same user and password and it works fine.

Where am I going wrong here?

Thanks,
Jason
Direct Responses: 7298 | Write a response
Posted on Sun Mar 9 07:44:50 2008 by jrupard in response to 7296
Re: Basic Auth Issue SOAP-WSDL-2.00_32
*SOAP::Transport::HTTP::get_basic_credentials = sub {

To
*SOAP::Transport::HTTP::Client::get_basic_credentials = sub {

I've found that the this code works fine when I'm connecting to a non-SSL endpoint. When the endpoint is SSL (https://server/webservice) I receive a 401 Unauthorized error.
Again, my soaplite client is working over SSL.

Regards,
Jason
Direct Responses: 7303 | Write a response
Posted on Sun Mar 9 19:16:32 2008 by mkutter in response to 7298
Re: Basic Auth Issue SOAP-WSDL-2.00_32
Hi Jason,
This is both a documentation error and a bug. The latter variant you tried is correct, but SOAP::WSDL tries to load a non-existent module from SOAP::Lite, so it uses it's own backend.
*SOAP::WSDL::Transport::HTTP::get_basic_credentials = sub { ... }
should help here.

Alternatively, you can use the SOAP::WSDL::Factory::Transport module from SOAP::WSDL's SVN (which already contains a fix) from https://soap-wsdl.svn.sourceforge.net/svnroot/soap-wsdl/SOAP-WSDL/trunk/lib/SOAP/WSDL/Factory/Transport.pm
thanks for reporting,
Martin
Write a response