How can I pass a SSL certificate to a SOAP server using SOAPpy / Python

3.5k views Asked by At

I am building a script to access a HTTPS/TLS TCP site that requires a X.509 certifcate that I have as a .pfx file.

I am using SOAPpy 0.12.5 and Python 2.7 and have started off with code as below,

import SOAPpy
url = "192.168.0.1:5001"
server = SOAPpy.SOAPProxy(url)

# I think I need to pass the cert to server here...

server.callSoapRPC(xxxx)

If I try running this it fails with the following message

socket.error: [Errno 10061] No connection could be made because the target machine actively refused it

Any sugestions how to tie the .pfx certificate to the SOAPproxy?

Thanks

1

There are 1 answers

3
Daniel Hartmann On

I managed to do it this way:

import SOAPpy
SOAPpy.Config.SSL.cert_file = 'cert_file'
SOAPpy.Config.SSL.key_file = 'key_file'

server = SOAPpy.SOAPProxy(url, config=config)