mvantellingen / python-zeep

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

[HELP] Operation exists but zeep raises "AttributeError: Service has no operation 'myOperation' " #1266

Closed andreapesci closed 2 years ago

andreapesci commented 2 years ago

Hello everyone!

Here the output of -mzeep command (just the part concerning the operations):

Service: serviceName
     Port: servicePort (Soap11Binding: {http://custom_url/portBinding)
         Operations:
            myOperation(param1: xsd:string,param2: xsd:string) -> return: xsd:string
            myOperation2(param1: xsd:string,param2: xsd:string,param3: xsd:string) -> return: xsd:string

I changed the names of the parameters, service name and so on for an easier understanding. Although, when using zeep in this way:

wsdl = "my_beautiful_soap_url?wsdl"
    client = zeep.Client(wsdl=wsdl)

    request_data = dict(
        param1="param1",
        param2="param2",
    )

    response = client.service['myOperation'](**request_data) 

    return response

it raises this error:

Traceback (most recent call last):
  File "~/main.py", line 84, in <module>
    zeep_test()
  File  "~/main.py", line 78, in zeep_test
    response = client.service["myOperation"](**request_data)
  File "~/main.py", line 99, in __getitem__
    raise AttributeError("Service has no operation %r" % key)
AttributeError: Service has no operation 'myOperation'

why is that? thanks for any help i will get!

P.S. just to be sure i got it right from the documentation: doing client.service['myOperation']() is the same as client.service.myOperation(**request_data) right?