I am new programing and I developed a small webservice in python using SOAPpy.
This webservice get some data from a sql Server and it returns in a list of tuples with this format [(a,b,c),(d,e,f),...] This is the server code:
class ws():
def recoveruserdata(self,param1,param2):
tupla_recover = ()
l_recover = []
...
cnxn = pyodbc.connect(con_string)
...
cursor.execute(query)
rows = cursor.fetchall()
for row in rows:
if row.id != ' ':
tupla_recover = (row.id,row.date)
l_recover.append(tupla_recover)
print l_recover
print "Len of lrecover ", len(l_recover)
print "first element ",l_recover[0]
return l_recover
if __name__ == '__main__':
server = SOAPServer(("localhost", 8082))
wsobj = ws()
server.registerObject(wsobj)
server.serve_forever()
The problem ocurrs when I try to consume the web service from a python client using SOAPpy too. I can get a list but it not contains the tuples as above, instead of it, you get a list of all individual elements with this format [a,b,c,d,e,f,....] This is the client code:
from SOAPpy import SOAPProxy
server = SOAPProxy("http://localhost:8082/")
cliente = server.recoveruserdata(param1,param2)
print cliente
My question is if, is it normal this behavior or am I doing something wrong?
I apreciate your help