SOAPpy and http authentication

benboals at gmail.com benboals at gmail.com
Tue Jan 3 12:17:31 EST 2006


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. wrote:
> 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
Lutz Horn wrote:
> On 2005-08-02, Odd-R. <oddr at home.no.no> wrote:
> > 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))
>
> 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 Andrich wrote:
> 2 Aug 2005 11:38:51 GMT, Lutz Horn <lutz.horn at gmx.de>:
> > On 2005-08-02, Odd-R. <oddr at home.no.no> wrote:
> > > 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))
> >
> > 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.
>
> 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
>
> --
> Oliver Andrich <oliver.andrich at gmail.com> --- http://fitheach.de/

 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




More information about the Python-list mailing list