|
From: Fabio S. <fa...@fa...> - 2003-11-15 00:05:59
|
Sorry if this post is stupid, but I'm a python newbie. I would like to do some experiments with webservices and I try to consume a web service that return an italian fiscal code (a simple string). I have to send some strings and a date (birth date). This is my first python code with ZSI: #wsdlURL = "http://www.pinellus.com/cfc/Cod_fiscale.cfc?wsdl"; import sys import datetime from ZSI import TC from ZSI import ServiceProxy cognome = 'Marco' nome = 'Rossi' sesso = 'M' comune = 'Milano' provincia = 'MI' nascita = datetime.date(1950,12,22) soapNascita = TC.gDate(nascita) service = ServiceProxy('http://www.pinellus.com/cfc/Cod_fiscale.cfc?wsdl') codice_fiscale = service.makecod(cognome,nome,sesso,comune,provincia,soapNascita) print codice_fiscale The error is: File "D:\MySoft\Python\codicefiscale\cf.py", line 16, in ? soapNascita = TC.gDate(nascita) File "C:\PROGRA~1\Python23\Lib\site-packages\ZSI\TC.py", line 65, in __init__ i = self.pname.find(':') AttributeError: 'datetime.date' object has no attribute 'find' I tried everything, also to pass the date in this way: nascita = datetime.date(1950,12,22).timetuple()[:9] but without success. Then I switch to SOAPpy and I rewrote the script in this way: #wsdlURL = "http://www.pinellus.com/cfc/Cod_fiscale.cfc?wsdl"; import datetime import SOAPpy def codiceFiscale(cognome, nome, sesso, comune, provincia, nascita, debug=0): if debug: return 'TESTTESTTESTTEST' service = SOAPpy.SOAPProxy("http://www.pinellus.com/cfc/Cod_fiscale.cfc") codice_fiscale = service.makecod(cognome,nome,sesso,comune,provincia,nascita) return codice_fiscale nascita = datetime.date(1950,12,22) cf = codiceFiscale('Rossi','Marco','M','Milano','MI',nascita) print cf No way out, the webservice is called but the return value is an exception: <Fault ns1:Server.userException: java.lang.NumberFormatException: Invalid date/time: {u'stackTrace': 'java.lang.NumberFormatException: Invalid date/time\r\n\tat org.apache.axis.encoding.ser.SimpleDeserializer.onEndElement ..... Could you point me in the right direction to solve this problem? Which are the main difference between ZSI, and SOAPpy ? Thanks in advance. -------------------------------------------------- FABIO SERRA - faser(at)faser.net PGP available -------------------------------------------------- |