Skip to content

Instantly share code, notes, and snippets.

@cherdt
Last active October 10, 2019 02:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cherdt/2e0f5f7d6fa06581d18f807172375715 to your computer and use it in GitHub Desktop.
Save cherdt/2e0f5f7d6fa06581d18f807172375715 to your computer and use it in GitHub Desktop.
Example SOAP 1.2 Request
# An example SOAP request
# See https://www.dataaccess.com/webservicesserver/NumberConversion.wso
# for other operations
import requests
url = 'https://www.dataaccess.com/webservicesserver/NumberConversion.wso'
headers = {'content-type': 'application/soap+xml; charset=utf-8'}
# Note that we name the XML namespace soap12
# We could name this anything we want, but it needs be consistent in the tags
body = '''<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>2019</ubiNum>
</NumberToWords>
</soap12:Body>
</soap12:Envelope>'''
soap_response = requests.post(url, data=body, headers=headers)
print(soap_response.content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment