mvantellingen / python-zeep

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

Can't create a Client instance due to KeyError #146

Closed FrugoFruit90 closed 8 years ago

FrugoFruit90 commented 8 years ago

I created a comment in some other person's issue but I can't find it now and probably it was a closed issue already so I create my own issue. Any idea what causes this to happen?

Here is the (public) wsdl/https: 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)

Traceback: File "C:/Users/j.zysko/gabinet/dilo/views_dilo.py", line 11, in client = Client(wsdl=wsdl1, transport=transport, wsse=UsernameToken('username', 'password')) 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'."

mvantellingen commented 8 years ago

This is an interesting one. The wsdl imports a wsdl which imports an xsd. It seems valid but isn't supported yet. I'll take a look at it asap

jacksonwoody commented 8 years ago

I also get this error with object instances from the wsdl I've posted in the None/Nil issue Michael, in case that helps with this issue: https://github.com/mvantellingen/python-zeep/issues/141

mvantellingen commented 8 years ago

This should be fixed now. If not could you let me know? (i'll reopen the issue again in that case)