Simple SOAP client and simple server via flask
2015-05-04
Objective:
To get current oil price in Thailand via SOAP and response in JSON format. SOAP Server URL for this scirpt: http://www.pttplc.com/webservice/pttinfo.asmx?WSDL
Prerequisite:
- Python 3.4
- flask
- flask-cors
- suds-jurko
- xmltodict
This script is located in https://gist.github.com/mildronize/56a35fb6d26d0e9002a1
#!/usr/bin/python3
=
=
# Get variable from http POST
=
=
=
=
=
# Get SOAP Service via suds
=
=
# Execute GetOilPrice method of SOAP
=
# Convert XML to dict
=
=
=
# Convert dict to JSON
return
# Get SOAP Service via suds
=
=
# Execute CurrentOilPrice method of SOAP
=
# Convert XML to dict
=
=
=
# Convert dict to JSON
return