- assigned_to: nobody --> boverhof
- summary: AttributeError: attribute get_element_foo previo --> complexType limitation: 2+ <element> same name
- status: open --> open-later
$ wsdl2py -bf test.wsdl
$ python -c "from DataReaderService_services import *"
Traceback (most recent call last):
File "<string>", line 1, in ?
File "DataReaderService_services.py", line 134, in ?
searchAnnotatablesRequest =
ns1.searchAnnotatables_Dec().pyclass
File "DataReaderService_services_types.py", line 85,
in __init__
TClist =
[GTD("http://identitymanagement.systemcore.mysys.myproject.eu","IdentificationData",lazy=False)(pname=(ns,"in0"),
aname="_in0", minOccurs=1, maxOccurs=1, nillable=True,
typed=False, encoded=kw.get("encoded")),
GTD("http://search.systemcore.mysys.myproject.eu","Query",lazy=False)(pname=(ns,"in1"),
aname="_in1", minOccurs=1, maxOccurs=1, nillable=True,
typed=False, encoded=kw.get("encoded"))]
File "DataReaderService_services_types.py", line 800,
in __init__
class Holder:
File
"build/bdist.macosx-10.3-fat/egg/ZSI/generate/pyclass.py",
line 97, in __new__
AttributeError: attribute get_element_dateOfCreation
previously defined.
Unfortunately it's not going to be easy to use this
WSDL with the "wsdl2py" tools. Here is an example of
the problem. You have 2 "dateOfCreation" elements.
"wsdl2py" isn't going to recognize this, so it will
create two typecodes with the same "aname". Which will
cause problems.
<xsd:sequence>
<xsd:element minOccurs="0" name="dateOfCreation"
type="xsd:dateTime"/>
....
....
<xsd:element minOccurs="0" name="dateOfCreation"
type="xsd:dateTime"/>
....
....
</xsd:sequence>
Here is the relevant generated code, I'm just pointing
out the "aname" here is the same. Now if you edit this
so the second one is different (eg. "_dateOfCreation2")
then it will work. But in your WSDL this appears to
happen ALOT.
class Query_Def(ZSI.TCcompound.ComplexType,
TypeDefinition):
schema =
"http://search.systemcore.mysys.myproject.eu"
type = (schema, "Query")
def __init__(self, pname, ofwhat=(),
attributes=None, extend=False, restrict=False, **kw):
ns = ns5.Query_Def.schema
TClist = [
ZSI.TCtimes.gDateTime(pname=(ns,"dateOfCreation"),
aname="_dateOfCreation", minOccurs=0, maxOccurs=1,
nillable=False, typed=False, encoded=kw.get("encoded")),
....
....
ZSI.TCtimes.gDateTime(pname=(ns,"dateOfCreation"),
aname="_dateOfCreation", minOccurs=0, maxOccurs=1,
nillable=False, typed=False, encoded=kw.get("encoded")),
....
....
]
This is a known limitation with a known work around
until the release.
Workaround: