This is part of my WSDL:
-----------------------------------------------------
<xs:complexType name="echoResponse">
<xs:sequence>
<xs:element minOccurs="0" name="return" type="xs:string"/>
</xs:sequence>
</xs:complexType>
-----------------------------------------------------
And this is the code I use to call my webservice:
-----------------------------------------------------
import sys
from ZSI.ServiceProxy import ServiceProxy
wsdl = 'http://localhost:8080/syringe-syringe/EchoService?wsdl'
service = ServiceProxy(wsdl, tracefile=sys.stdout)
print service.echo("Echoed via ZSI")
-----------------------------------------------------
The auto-generated file .service_proxy_dir/http___localhost_8080_syringe_syringe_EchoService_wsdl_types.py now contains a syntax error: "self.return = None" on line 52 (I've attached the file, as well as my source code and the WSDL). The "return" on that line is the value of the "name" attribute in the WSDL.
I think it's rather strange that ZSI assumes that the name of an <xs:element /> will always be a valid variable name in Python. There should at least be a check and a workaround for this.
File Added: EchoService.wsdl
File Added: EchoService_wsdl_types.py
This isn't ZSI as a whole, this is the ServiceProxy module in particular attempting to employ the simplest algo possible. It uses the code generator, and by default shuts off name mangling for simplicity.
# dont do anything to anames
if not self._pyclass:
containers.ContainerBase.func_aname = lambda instnc,n: str(n)
You could replace this function with whatever you like eg. if n == "return": return "Return"
ServiceProxy could easily be refactored to give you something that covered keywords..
It was my intent that people who needed something more would use the pyclass option:
ServiceProxy(wsdl, pyclass=True, ..)
and this should solve your problem.