SOAPpy and http authentication

B

benboals

Note: this is in reply to a message from August 2 which i found
searching for help on my own problem. I couldn't seem to reply to it,
but a friend suggested that simply using the same subject would put it
in that thread. In case he's wrong, i quoted the previous comments .
Odd-R. said:
I use the following piece of code to contact a webservice,
and read a wsdl file.

from SOAPpy import WSDL
from SOAPpy import URLopener
url= ' http://someserver/somewebservice
url1 = URLopener.URLopener(username='user',passwd='pass')
server=WSDL.Proxy(url1.open(url))

This yields no errors, and everyting is fine.

However, when I start calling the actual methods of
this webservice, I get this error

SOAPpy.Errors.HTTPError: <HTTPError 401 Unauthorized>

How can I avoid this?

Thanks in advance for all help!

--
Har du et kjøleskap, har du en TV
så har du alt du trenger for å leve

-Jokke & Valentinerne

Is it possible to call WSDL.Proxy with a String? Then you could build
the URL als http://user:pass@someserver/somewebservice. This works
with SOAPpy.SOAPProxy.

Lutz
Oliver said:
Yes, you can actually call it that way, but then the wsdl retrieval is
done using the authentication, but all the service calls are done
without. This is something, that is also puzzling me. So far I can
perfectly live with SOAPProxy, but it would be nice to solve this
puzzle.

Best regards,
Oliver

I tracked the culprit down to the fact that the Client.py file creates
its own http instance in the transport class, which doesn't seem to
remember any authorization you did when you called the wsdl.proxy to
begin with (except for possibly doing basic auth with addr.user and
addr.password?).

I've been trying to authenticate using ntlm and had a similar problem.

Currently, i can authorize via ntlm enough to get the wsdl, by using
the fetch_url.py example in the sspi folder (installed as part of the
python windows extensions). When I try to call services, however, our
friend the 401 error appears. (or, after i modify client some, the 500
series pesters me =P )

At the moment, I'm trying to rewrite client.py for my needs,( half of
which is breaking things into functions and renaming internal variables
where outside callers don't use them, ie ns becomes namespace, sa
becomes soapaction, etc...getting the full names from elsewhere in the
file, so the logic is more clear to me,) but I'd <b>really</b> prefer
it if anyone knows a solution that doesn't involve meddling with
SOAPpy.

Sincerely,
Ben Boals
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top