1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
import tornado.ioloop
from tornadows import soaphandler, webservices, complextypes
from tornadows.soaphandler import webservice
import datetime
from Client import *
from ClientDAO import *
from Facture import *
from FactureDAO import *
from Encaissement import *
from EncaissementDAO import *
import pyodbc
from VerificationDate import *
class InputRequest(complextypes.ComplexType):
idperson = str
class BillResponse(complextypes.ComplexType):
cod_facture = str
libelle = str
montant = float
cod_cli = str
class myfirstwstestwithtornado(soaphandler.SoapHandler):
@webservice(_params=InputRequest, _returns=BillResponse)
def getCertificate(self, input):
idclient = input.idperson
self.connexion=pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=db_encaissement;UID=sa;PWD=Azerty01')
self.cursor=self.connexion.cursor()
self.cursor.execute("select * from tbl_facture where cod_client='%s'"%idclient)
rows=self.cursor.fetchall()
for row in rows:
fac = BillResponse()
fac.cod_facture = str(row.cod_facture)
fac.libelle = row.lib_facture
fac.montant = float(row.montant_facture)
fac.cod_cli = idclient
return fac
if __name__ == '__main__':
service = [('myfirstwstestwithtornado',myfirstwstestwithtornado)]
app = webservices.WebService(service)
app.listen(8080)
tornado.ioloop.IOLoop.instance().start() |
Partager