mvantellingen / python-zeep

A Python SOAP client
http://docs.python-zeep.org
Other
1.88k stars 585 forks source link

SSL: CERTIFICATE_VERIFY_FAILED] #63

Closed abhidotnet closed 8 years ago

abhidotnet commented 8 years ago

My wsdl service is hosted on https The certificate on the IIS server is a self-signed certificate. I get this error from zeep.

The command I am running is

python -mzeep https://mysecureservice.svc?wsdl


  File "C:\Python27\lib\site-packages\requests\sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python27\lib\site-packages\requests\adapters.py", line 477, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verif
y failed (_ssl.c:590)
mvantellingen commented 8 years ago

You need to initialize the transport yourself and pass verify=false. See http://docs.python-zeep.org/en/latest/transport.html#transport-options

abhidotnet commented 8 years ago

How do I do that on the command line?

mvantellingen commented 8 years ago

Valid point, just added it via --no-verify. You need to install the latest version for this. pip install https://github.com/mvantellingen/python-zeep/archive/master.zip#egg=zeep

abhidotnet commented 8 years ago

Thanks for the quick response. Appreciate you building this library.

abhidotnet commented 8 years ago

After the latest update to my library, I am seeing the following message on the command line.

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='q2devapp.myhost
.com', port=443): Max retries exceeded with url: /OperationalService.svc?wsdl (C
aused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPS
Connection object at 0x00000000033DEE10>: Failed to establish a new connection:
[Errno 11004] getaddrinfo failed',))
FrugoFruit90 commented 8 years ago

I also have an https wsdl: https://test-dilo.nfz.gov.pl/ws-broker-server-pkus-auth/services/Auth?wsdl

My code: from zeep import Client from zeep.transports import Transport

transport = Transport(verify=False) wsdl1 = 'https://test-dilo.nfz.gov.pl/ws-broker-server-pkus-auth/services/Auth?wsdl' client = Client(wsdl=wsdl1, transport=transport, wsse=UsernameToken('username', 'password'))

Traceback: File "C:/Users/j.zysko/gabinet/dilo/views_dilo.py", line 6, in client = Client(wsdl=wsdl1, transport=Transport(verify=False)) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\client.py", line 52, in init self.wsdl = Document(wsdl, self.transport) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\wsdl\wsdl.py", line 62, in init root_definitions = Definition(self, document, self.location) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\wsdl\wsdl.py", line 156, in init self.messages = self.parse_messages(doc) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\wsdl\wsdl.py", line 320, in parse_messages msg = definitions.AbstractMessage.parse(self, msg_node) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\wsdl\definitions.py", line 61, in parse part_element = definitions.types.get_element(part_element) File "C:\Users\j.zysko\Envs\gabinet\lib\site-packages\zeep\xsd\schema.py", line 80, in get_element ) % (qname.text, qname.namespace)) KeyError: u"Unable to resolve element {http://xml.kamsoft.pl/ws/common}session. No schema available for the namespace u'http://xml.kamsoft.pl/ws/common'."

It would seem that I need a schema BEFORE actually creating the Client object?