T
Tom Willis
I am not a SOAP/Web Services expert!!!!!!
But I had to interface with some webservice code here at work. I was
reading on the net the complextypes didn't work or were finnicky
etc....
Well I managed to get it to work on Zolera 1.7. First the code
generated from the wsdl didn't work without some editing due to types
being declared later in the file but referenced earlier, and being in
different namespaces.
The next hurdle was getting the request to serialize properly. My
request consisted of some strings and a complextype which was nothing
but strings accept for a date.
The date serialization was throwing an error. There was an article on
ibm dev works where they claimed to not be able to get it to work. So
I tried some things
def parsedatestring(datestr):
#SQLServer Date Format delimited by space 1st part date (/) 2nd
part time )
dt = datestr.strip("'").split(" ")
month,day,year = dt[0].split("/")
hour,minute,second = dt[1].split(":")
#this one works
return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second)).utctimetuple()
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError int argument
required"
#return "%s-%s-%s" % (year,month,day)
#throws error " Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError int argument
required"
#return "%s-%s-%sT%s:%s:%s" % (year,month,day,hour,minute,second)
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((int(year),int(month),int(day),int(hour),int(minute),int(second)))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((year,month,day,hour,minute,second))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((float(year),float(month),float(day),float(hour),float(minute),float(second)))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError iteration over
non-sequence"
#return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second))
Call me stupid, but I could not find out anywhere in the ZLI docs, the
web, code or anything that specified I pass a utctimetuple. As a
client of the API, I would assume it would be converted for me if I
pass a python object.
Anyway, I'm not bitching so much about the api as I am making an
effort to get this out there on the web just in case someone else is
hitting a brick wall on webservice interaction with python.
I'm not convinced that Simple Object Access Protocol is actually
simple. I guess if you compare to raw sockets yeah. Easier than COM+ ?
Hardly.
But I had to interface with some webservice code here at work. I was
reading on the net the complextypes didn't work or were finnicky
etc....
Well I managed to get it to work on Zolera 1.7. First the code
generated from the wsdl didn't work without some editing due to types
being declared later in the file but referenced earlier, and being in
different namespaces.
The next hurdle was getting the request to serialize properly. My
request consisted of some strings and a complextype which was nothing
but strings accept for a date.
The date serialization was throwing an error. There was an article on
ibm dev works where they claimed to not be able to get it to work. So
I tried some things
def parsedatestring(datestr):
#SQLServer Date Format delimited by space 1st part date (/) 2nd
part time )
dt = datestr.strip("'").split(" ")
month,day,year = dt[0].split("/")
hour,minute,second = dt[1].split(":")
#this one works
return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second)).utctimetuple()
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError int argument
required"
#return "%s-%s-%s" % (year,month,day)
#throws error " Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError int argument
required"
#return "%s-%s-%sT%s:%s:%s" % (year,month,day,hour,minute,second)
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((int(year),int(month),int(day),int(hour),int(minute),int(second)))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((year,month,day,hour,minute,second))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError not all
arguments converted during string formatting"
#return tuple((float(year),float(month),float(day),float(hour),float(minute),float(second)))
#throws "Exception Serializing demo
xmlns="http://DefaultNamespace"._birthDate, TypeError iteration over
non-sequence"
#return datetime(int(year),int(month),int(day),int(hour),int(minute),int(second))
Call me stupid, but I could not find out anywhere in the ZLI docs, the
web, code or anything that specified I pass a utctimetuple. As a
client of the API, I would assume it would be converted for me if I
pass a python object.
Anyway, I'm not bitching so much about the api as I am making an
effort to get this out there on the web just in case someone else is
hitting a brick wall on webservice interaction with python.
I'm not convinced that Simple Object Access Protocol is actually
simple. I guess if you compare to raw sockets yeah. Easier than COM+ ?
Hardly.