4

Based on this documentation to use certificates:

https://python-zeep.readthedocs.io/en/master/transport.html

My code is:

from zeep import Client as zeepClient
from zeep.transports import Transport
from requests import Session
import os

file_pem = os.path.dirname(os.path.realpath(__file__)) + "/file.pem"
session = Session()
session.verify = file_pem
transport = Transport(session=session)
zeepclient = zeepClient('https://myurl.com:8000/demo/services/User?wsdl', transport=transport)
result = zeepclient.service.adUser(payload)

It doesn't work.

Error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='myurl.com', port=8000): Max retries exceeded with url: /demo/services/User?wsdl (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))

Example .pem file:

-----BEGIN CERTIFICATE----- MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJzAlBgNVBAMTHkRpZ2lDZXJ0IFNIQTIg MIIElDCCA3ygAwIBAgIQAf2j627KdciIQ4tyS8+8kTANBgkqhkiG9w0BAQsFADBh MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD QTAeFw0xMzAzMDgxMjAwMDBaFw0yM................................... ....................................eNqzqPlt/yGFUzZgTHbO7Djc1lGA 8MXW5dRNJ2Srm8c+cftIl7gzbckTB+6WohsYFfZcTEDts8Ls/3HB40f/1LkAtDdC 2iDJ6m6K7hQGrn2iWZiIq -----END CERTIFICATE-----

  • 1
    Hi Carlos, did you solver this issue? I'm facing a similar problem, I have to use a SOAP service which requires a certificate to access the service. I have a pem file that I can use successfully with SoapUI-5.6.0. The thing is that when I try to make the call using the `requests` package I get an error because the certificate of the URL I'm pointing to is self-signed. Any comments about how you solved the issue will be appreciated! – Jordi Vidal de LLobatera Sep 29 '20 at 07:21
  • Hi @JordiVidaldeLLobatera! Did you solved the issue? I'm facing the same problem here – David López Nov 09 '21 at 02:07

0 Answers0