Created
October 25, 2018 18:27
-
-
Save harsha547/5b87c1ffd1d2d72025571f8e8b314684 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from zeep import Client | |
| from pprint import pprint | |
| wsdl = 'http://psleci.nic.in/GService.asmx?wsdl' | |
| client = Client(wsdl) | |
| def parseElements(elements): | |
| all_elements = {} | |
| for name, element in elements: | |
| all_elements[name] = {} | |
| all_elements[name]['optional'] = element.is_optional | |
| if hasattr(element.type, 'elements'): | |
| all_elements[name]['type'] = parseElements( | |
| element.type.elements) | |
| else: | |
| all_elements[name]['type'] = str(element.type) | |
| return all_elements | |
| interface = {} | |
| for service in client.wsdl.services.values(): | |
| interface[service.name] = {} | |
| for port in service.ports.values(): | |
| interface[service.name][port.name] = {} | |
| operations = {} | |
| for operation in port.binding._operations.values(): | |
| operations[operation.name] = {} | |
| operations[operation.name]['input'] = {} | |
| elements = operation.input.body.type.elements | |
| operations[operation.name]['input'] = parseElements(elements) | |
| interface[service.name][port.name]['operations'] = operations | |
| pprint(interface) | |
| # Following request data is for ANDHRA PRADESH , SRIKAKULAM, Ichchapuram | |
| request_data = { | |
| 'SetLatLon': { | |
| 'pID': '2819', | |
| 'pLatitude': 84.5963714363732, | |
| 'pLongitude': 19.0054767376423, | |
| } | |
| } | |
| print(client.service.GetGoogleObject()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment