Call Web Service using proxy and http authentication

wdveloper totobe at gmail.com
Tue May 12 15:51:37 EDT 2009


On May 12, 8:38 pm, Steve Howell <showel... at yahoo.com> wrote:
> On May 12, 8:59 am, wdveloper <tot... at gmail.com> wrote:
>
> > Hi everyone,
>
> > I am trying to call a webservice which requires an http
> > authentication.
> > To reach the ws, I must pass from a proxy http. So in the whole I need
> > go through two authentications before getting the ws working. I am
> > using SOAPpy and I'm getting quite crazy.
> > I am able to arrange this problem with simple http calls using urllib2
> > but for the ws i dont see any way out.
>
> > Does anyone knows how I can manage this stuff? Is there any better
> > solution or example code?
>
> Your high level description of the problem is good, but I think you'll
> get more help if you provide a little more detail.
>
> For something like this you may want to try to do more at the HTTP
> level, where you have a little more control over the authentication,
> and then find a way to hook into SOAPpy just to build and parse the
> payloads.
>
> How good is your understanding of HTTP?  Do you know the basics of how
> headers work?  You might want to brush up a little on HTTP just to
> help understand what's going on; it will almost certainly be valuable
> for future projects as well.
>
> To understand how the proxy works in particular, if you can use the
> proxy to access a normal html-serving website, you can use the "Live
> HTTP Headers" tool under Firefox to see what's going on.
>
> But before all that, I would maybe just post a little more detail on
> the problem.  Maybe show code you've written so far, and any error
> messages/tracebacks, to better indicate where you are stuck.

Thank you very much Steve,

I do have a good understanding of http and its headers rules, and of
course I can work on that.
On the other hand, I am new to python and SOAPpy toolkit and I dont
have much of an experience working with ws in general.

When it comes of working with simple call to WS, everything is
successfull; problems start cause I dont know how to use the toolkit
to compose the http request. I should code it in the way that it
connects to my proper proxy and it gets authenticated in the server
exposing the service.

What I have is something like:
from SOAPpy import WSDL

wsdl = 'http://myws?wsdl'
my_http_proxy = '10.x.x.x:8080'
proxy = WSDL.Proxy(wsdl, http_proxy=my_http_proxy)
res = proxy.myService( myparam='...' )

What I get is that connection reaches timeout since the server doesnt
see me coming from the right proxy.
First problem, I can't see where I can put my proxy authentication
username and password.
Second, when I will be able to pass through the right proxy, I need to
authenticate on the server via http through my credential.

I am starting wondering whether python+SOAPpy is the right solution or
I need to switch to other solutions (zsi?).

I hope I've been more detailed now and my situation sounds little more
clear.
Thanks again for your precious help!



More information about the Python-list mailing list