I have soap service under Apache with ssl, suds works greate without ssl.
I have client certificate (my.crt and user.p12 files).
How I need to configure suds client ot make it work with service over https?
without certs i see
urllib2.URLError: <urlopen error [Errno 1] _ssl.c:499: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure>
Based on @k4ml answer, I've only added the
open()
which allows to fetch the WSDL using the certificate.This method should fix the
suds.transport.TransportError: HTTP Error 403: Forbidden
when trying to fetch a WSDL (at Client creation) served behind a HTTPS service.Side note, I've also made a suggested edit to k4ml's answer, but it can take ages before it gets approved.
Another workaround is to use requests library as transport which has better support for ssl. This is what I'm using now to access SOAP services through https using suds:-
And then you can instantiate suds client as:-
Update
We're now using Zeep, which use
requests
underneath.It sounds like you want to authenticate using a client certificate, not a server certificate as was stated in some of the comments. I had the same issue and was able to write a custom transport for SUDS. Here's the code that works for me.
You'll need your certificates in PEM format for this to work; OpenSSL can easily perform this conversion, though I don't remember the exact syntax.
SSL security feature is auto enabled python 2.7.9+ which breaks suds and other python libraries. I am sharing a patch which can fix this:
Locate you suds library and replace u2handlers function in suds/trasnport/http.py file with following line:
Note: It's not a recommended way of doing it.
Extending @k4ml solution, using cert + key This will solve exceptions like:
Solution: