Skip to content

create_service for AsyncClient #1168

@jenson2486

Description

@jenson2486

Version: zeep 4.0.0
WSDL: 'http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL'

Hi guys,
i am starting developing a soap interface based on zeep. Our application works mostly async, so I try to use the AsyncClient. Additional I test the interface against a mock, placed in soap_ui. For using the mock, it is necessary to define the endpoint to the mock, so I used the create_service method.

client = AsyncClient(wsdl='http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL')
service = client.create_service('{http://www.dataaccess.com/webservicesserver/}NumberConversionSoapBinding',
                                'http://[replaced]:8088/mockNumberConversionSoapBinding')
loop = asyncio.new_event_loop()
print(loop.run_until_complete(service.NumberToDollars(2)))

The expception log:

Traceback (most recent call last):
  File ".\tests\minimal_examples\soap.py", line 46, in <module>
    print(loop.run_until_complete(service.NumberToDollars(2)))
  File "[replaced]\.tox\dev\lib\site-packages\zeep\proxy.py", line 46, in __call__
    return self._proxy._binding.send(
  File "[replaced]\.tox\dev\lib\site-packages\zeep\wsdl\bindings\soap.py", line 135, in send
    return self.process_reply(client, operation_obj, response)
  File "[replaced]\.tox\dev\lib\site-packages\zeep\wsdl\bindings\soap.py", line 177, in process_reply
    if response.status_code in (201, 202) and not response.content:
AttributeError: 'coroutine' object has no attribute 'status_code'
sys:1: RuntimeWarning: coroutine 'AsyncTransport.post_xml' was never awaited

After some research, the reason is the create_service method, defined in the sync client, which returns a sync ServiceProxy object, but exected will be a AsyncServiceProxy object.

Is my assumption right?

BR Jens

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions