Personal blog of Alex Muratov

Python SUDS, WSDL, HTTPS proxy and SOAP authentication.

Posted on November 26, 2013 | in Python | by

pythonToday I would like to share a recipe how to utilize WSDL (SOAP) in a Python SUDS script behind the HTTPS proxy. It may be useful for getting some commercial feeds on a server sitting behind the corporate firewall.

First of all, I find out the Python SUDS are very convenient. You can download it here or just install it via yum (or apt-get):

yum install python-suds

It is compatible even with older Python 2.4 (too bad that it does not have ElementTree).

OK, but now the issue – SUDS ignores env setting for proxy, whenever you try to connect to a WSDL service, it simply time outs. Furthermore all attempts to explicitly specify proxy settings fail:

Depending how you specify the proxy settings, the SUDS either time outs or returns really weird error about EOF in communication. The reason is simple – by default the urllib2 is not compatible with HTTPS proxy. It is able to utilize a HTTP proxy, but not a HTTPS proxy. Too bad!

Finally I find out the following solution:

1. Implement a “opener” for SSL proxy:

urrlib2 opener for SSL proxy (CONNECT method) (Python recipe)

2. Utilize this opener properly:

3. Add credentials to the WSDL client object:

The last step depends on particular WSDL service specification for credentials, please consult the Web API service document.

TAGS: , , ,

Leave a Reply

BOINC

BOINC

Ads

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Calendar

November 2013
M T W T F S S
« Jul   Jul »
 123
45678910
11121314151617
18192021222324
252627282930  
%d bloggers like this: