NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Error: HTTP Error: HTTP authentication failed


Joined: 18 Aug 2007
Posts: 4
Reply with quote
hi,

Anyone solved this error before?

soapclient: got wsdl error: HTTP ERROR: Error using gzinflate to un-gzip the payload wsdl error: HTTP ERROR: Error using gzinflate to un-gzip the payload

Setup:
1. client.php:
$client = new soapclient('https://'.$username.':'.$password.'@www.xxxxxxx.com/ws/server.php?wsdl', true);

2. .htaccess on server is setup as follows:
AuthUserFile /home/xxxxxxx/.htpasswd
AuthGroupFile /dev/null
AuthName "Protected Area"
AuthType Basic
<Limit GET POST>
require user wsuser
</Limit>

is the url setup correctly?

thanks!
Jonathan


Last edited by jr_major on Sun Aug 19, 2007 1:00 pm; edited 1 time in total
View user's profileFind all posts by jr_majorSend private message


Joined: 18 Aug 2007
Posts: 4
Reply with quote
This was a error in one of my server.php function's syntax.

Now I am getting a 401 error:

2007-08-19 19:00:26.052578 soap_transport_http: Got 401 Authorization Required with WWW-Authenticate: Basic realm="Protected Area"
2007-08-19 19:00:26.052641 soap_transport_http: HTTP authentication failed
2007-08-19 19:00:26.052707 soap_transport_http: end of send()
2007-08-19 19:00:26.052837 soapclient: Error: HTTP Error: HTTP authentication failed

my (apache 2.0) htaccess is setup as follows:
AuthUserFile /home/xxxxxxxx/.htpasswd
AuthGroupFile /dev/null
AuthName "Protected Area"
AuthType Basic
<Limit GET POST>
require user wsuser
</Limit>

and my client is calling the wsdl like this:
$password = urlencode("**********");
$username = "wsuser";
$wsdl = "https://".$username.":".$password."@www.xxxxxx.com/ws/server.php?wsdl";
$client = new soapclient($wsdl, true);
$client->setCredentials($username, $password);

any help is much appreciated!
View user's profileFind all posts by jr_majorSend private message
Site Admin

Joined: 13 Jul 2003
Posts: 7857
Reply with quote
probably you need to enable WSDL file retrival without authentication Smile or have client-side copy of it and use it instead of the WSDL url

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 26 Jul 2007
Posts: 14
Reply with quote
You might also want to put this into your client:

Code:
$client->setCredentials($username, $password, "basic"); 


I went through something like what you are doing, a https connection and if you just set your information the way you did, it's still not enough, you will need to put in the information that I have above after you declare your client with your username password.

-Addison
View user's profileFind all posts by addisonpSend private message


Joined: 18 Aug 2007
Posts: 4
Reply with quote
hi,

thanks for the responses!

1. I tried adding "basic" but still getting http authentication error.
2. An interesting suggestion to keep the wsdl localhost from the clients perspective. Is that a known workaround? I'm just wondering if that implies a bug in nusoap?

I am also trying the other authentication methods: 'digest' and 'allow from ip'

thanks again!
Jonathan
View user's profileFind all posts by jr_majorSend private message


Joined: 26 Jul 2007
Posts: 14
Reply with quote
just to make sure:

1. did you use
$client = new soapclient('https://'.$username.':'.$password.'@www.xxxxxxx.com/ws/server.php?wsdl', true);

and
2. did you also use
$client->setCredentials($username, $password, "basic");

I had to use both to make it work when going through https

-Addison
View user's profileFind all posts by addisonpSend private message


Joined: 18 Aug 2007
Posts: 4
Reply with quote
I got it to work by using access control in the .htaccess as opposed to

AuthType Basic
AuthName <auth name>
Order allow,deny
Allow from <IP>
Satisfy any

This works for me as I am only ever calling the webservice from a limited set of IPs.

thanks!
View user's profileFind all posts by jr_majorSend private message
Error: HTTP Error: HTTP authentication failed
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic