In [5]:
from suds.client import Client
In [9]:
url = 'http://10.192.224.5:7006/CommonServices_SB/ProxyService/GetMSISDNProfileProxy?wsdl'
client = Client(url)
In [10]:
def GenerateMethods(client):
methodInputList = []
methodInputDict = {}
for method in client.wsdl.services[0].ports[0].methods.values():
methodInputDict["name"]= str(method.name)
#methodInputDict["inputs"]=[]
for part in method.soap.input.body.parts:
methodInputDict["inputs"]={}
for k,v in client.factory.create(part.element[0]):
methodInputDict["inputs"][k]=v
#print '%s(%s)' % (method.name, ', '.join('%s' % (client.factory.create(part.element[0])) for part in method.soap.input.body.parts))
#print "\n\n\n\n"
methodInputList.append(methodInputDict)
methodInputDict = {}
return methodInputList
methods = GenerateMethods(client)
for method in methods:
print method['name'],method['inputs']
#print "Method: %s , Input %s"%(method["name"],method["inputs"])
In [8]:
import sys
import json
print json.dumps(methods)
tmp = methods[0]['inputs']
tmp['MSISDN']='96565000570'
methods[0]['inputs'] = tmp
for method in methods:
try:
print getattr(client.service,method['name'])(**method['inputs'])
except:
e = sys.exc_info()[0]
print e
In [247]:
tmp = methods[1]['inputs']
tmp['Year']='2014'
tmp['Month']='9'
methods[1]['inputs'] = tmp
print methods[1]['inputs']
getattr(client.service,methods[1]['name'])(**methods[1]['inputs'])
Out[247]:
In [4]:
from SoapProxy import models
In [3]:
In [ ]: