Call Web Service using proxy and http authentication

W

wdveloper

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?

Thanks very much for your help,
totobe
 
S

Steve Howell

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.
 
W

wdveloper

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!
 
S

Steve Howell

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.


Have you looked at the URLopener class?
 
W

wdveloper

Have you looked at the URLopener class?

At the end what I did is to use the authentication components offered
by urllib2.
Just I had to hand write the SOAP message outcoming, losing the chance
to use SOAPpy.
Anyway it seems to work this way,
thanks again
 

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

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top