mvantellingen / python-zeep

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

AttributeError: 'NoneType' object has no attribute 'get' #527

Closed luanfonceca closed 5 years ago

luanfonceca commented 7 years ago

Hi folks, i am getting this error when i try to create a client based on a wsdl file with Zeep. Can you guys help me out here? I never had worked with soap web services before.

Traceback:

Traceback (most recent call last):
  File "BE-zeep.py", line 5, in <module>
    zeep.Client(wsdl=wsdl)
  File "/Users/.../lib/python3.6/site-packages/zeep/client.py", line 123, in __init__
    self.wsdl = Document(wsdl, self.transport, strict=strict)
  File "/Users/.../lib/python3.6/site-packages/zeep/wsdl/wsdl.py", line 82, in __init__
    root_definitions.resolve_imports()
  File "/Users/.../lib/python3.6/site-packages/zeep/wsdl/wsdl.py", line 237, in resolve_imports
    service.resolve(self)
  File "/Users/.../lib/python3.6/site-packages/zeep/wsdl/definitions.py", line 295, in resolve
    is_resolved = port.resolve(definitions)
  File "/Users/.../lib/python3.6/site-packages/zeep/wsdl/definitions.py", line 267, in resolve
    force_https)
  File "/Users/.../lib/python3.6/site-packages/zeep/wsdl/bindings/soap.py", line 197, in process_service_port
    address_node = xmlelement.find('soap:address', namespaces=self.nsmap)
AttributeError: 'NoneType' object has no attribute 'get'

WSDL file:

https://dr-hml.neurotech.com.br/services/soap/porting?wsdl

Package Versions:

zeep==2.3.0
Python==3.6.1

Script:

import zeep

wsdl = 'https://dr-hml.neurotech.com.br/services/soap/porting?wsdl'
zeep.Client(wsdl=wsdl)
luanfonceca commented 7 years ago

cc @renatooliveira

LoveGlitchCoffee commented 7 years ago

Also running into this issue and looking into it myself

LoveGlitchCoffee commented 7 years ago

I have managed to track down the bug to being in lxml rather than zeep. it seems my version of lxml is outdated, and hence throwing a StopIteration exception, which is causing find() to return None.

@luanfonceca What is your lxml version?

mvantellingen commented 7 years ago

Can you give master a try?

deronnax commented 7 years ago

@mvantellingen : I was able to reproduce the bug with the latest stable release (2.3.0). I gave a try with master (6dce326), I can confirm it's fixed.

LoveGlitchCoffee commented 7 years ago

@luanfonceca I just realised there was an error in the .wsdl from my side, which gave the error (soap12 tags specified in soap binding). so it may be that