简体   繁体   中英

Failed to work with multiple WSDLs using Python zeep

I have WSDL service which provides several links like

http://localhost:8081/View1&Wsdl
...
http://localhost:8081/ViewN&Wsdl

But the problem is that I can't work with multiple WSDL links using zeep library (2.5.0)

My code:

import zeep

view1_wsdl = 'http://localhost:8081/View1&Wsdl'
client1 = zeep.Client(wsdl=view1_wsdl)
result1 = client1.service.method1()
print(result1) 

view2_wsdl = 'http://localhost:8081/View2&Wsdl'
client2 = zeep.Client(wsdl=view2_wsdl)
result2 = client2.service.method2()
print(result2)

I get correct result1, but there's error with result2:

Traceback (most recent call last):
  File "C:/.../auto_tests/wsdl_check.py", line 17, in <module>
    result2 = client2.service.method2
  File "C:\...\lib\site-packages\zeep\client.py", line 45, in __call__
    self._op_name, args, kwargs)
  File "C:\...\lib\site-packages\zeep\wsdl\bindings\soap.py", line 110, in send
options=options)
  File "C:\...\lib\site-packages\zeep\wsdl\bindings\soap.py", line 68, in _create
    serialized = operation_obj.create(*args, **kwargs)
  File "C:\...\lib\site-packages\zeep\wsdl\definitions.py", line 197, in create
    return self.input.serialize(*args, **kwargs)
  File "C:\...\lib\site-packages\zeep\wsdl\messages\soap.py", line 63, in serialize
    body_value = self.body(*args, **kwargs)
  File "C:\...\lib\site-packages\zeep\xsd\elements\element.py", line 48, in __call__
    instance = self.type(*args, **kwargs)
  File "C:\...\lib\site-packages\zeep\xsd\types\complex.py", line 42, in __call__
    return self._value_class(*args, **kwargs)
  File "C:\...\lib\site-packages\zeep\xsd\valueobjects.py", line 90, in __init__
    items = _process_signature(self._xsd_type, args, kwargs)
  File "C:\...\lib\site-packages\zeep\xsd\valueobjects.py", line 194, in _process_signature
    len(result), num_args))
TypeError: __init__() takes at most 0 positional arguments (1 given)

How can I deal with it?

问题出在WSDL服务中,而不是zeep lib中。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM