Skip to content

Instantly share code, notes, and snippets.

@jvmaia
Created April 17, 2021 02:55
Show Gist options
  • Save jvmaia/a54f8709dba31be81cdbe09601730857 to your computer and use it in GitHub Desktop.
Save jvmaia/a54f8709dba31be81cdbe09601730857 to your computer and use it in GitHub Desktop.
unexpected element
import pretend # pip install pretend
from zeep import Client
from zeep.transports import Transport
client = Client('http://www.dataaccess.com/webservicesserver/numberconversion.wso?WSDL')
response = pretend.stub(
status_code=200,
headers={},
content="""
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.dataaccess.com/webservicesserver/">
<soapenv:Header/>
<soapenv:Body>
<web:NumberToDollarsResponse>
<web:NumberToDollarsResult>two dollars</web:NumberToDollarsResult>
<web:testing>it will raise an error</web:testing>
</web:NumberToDollarsResponse>
</soapenv:Body>
</soapenv:Envelope>
""")
operation = client.service._binding._operations['NumberToDollars']
result = client.service._binding.process_reply(client, operation, response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment