[Soap-Python] Complex types with quirks, declaring them in rpclib
ralienpp at gmail.com
Tue Mar 20 23:29:48 CET 2012
In parallel with writing the documentation for input validation in
rpclib, I am trying to apply rpclib to solve the problem that brought
me to this list in the first place.
I began creating my custom types and I ran into some cases which don't
seem to be straightforward.
One of the types looks like this
<xs:element name="DigestMethod" type="ds:DigestMethodType" minOccurs="0"/>
<xs:element name="DigestValue" type="ds:DigestValueType"/>
ds:DigestMethodType is in another namespace, the link to which is
given in the beginning of the WSDL file. If I understand things
correctly, I have to create a custom class for DigestMethodType and
override its __namespace__ = 'ds'. Can you confirm that?
(1) It is also necessary to modify the top of the generated WSDL file
and include a link to the document that defines the 'ds' namespace.
How to do that? I supposed I could also override the namespace with a
URL to the XML file itself, but is that a good practice?
DigestMethodType itself is a tricky beast, this is the definition:
<complexType name="DigestMethodType" mixed="true">
<any namespace="##other" processContents="lax" minOccurs="0"
<attribute name="Algorithm" type="anyURI" use="required"/>
(2) how does rpclib handle 'namespace="##other"'? My understanding is
that it means I can add an arbitrary number of elements of any type.
The closest match I could find is AnyXml or AnyDict (declared in
primitive.py). However, I am not sure how to use it; test_primitive.py
doesn't cover these two classes.
(3) 'use="required"' - the 'use' attribute is not declared in the
AnyUri class, neither in Unicode or SimpleModels (the classes from
which it was derived). It seems to be a basic attribute; was I unable
to find it? Or is it really not there?
(4) 'mixed' is another attribute that I didn't find declared in the
base class of the ComplexType class? Does one really need it? I mean,
maybe it is assumed that all the ComplexType children are mixed by
There's another data type with the poetic name 'DataType' :-)
<xs:attribute name="MimeType" type="xs:string" use="optional"/>
<xs:attribute name="Encoding" type="xs:string" use="optional"/>
I've seen how to declare elements and attributes in a custom type, but
this is something new to me. It feels like some kind of inheritance,
(5) How to declare such a type?
I will update the documentation and add some examples of this as soon
as I figure it out myself.
More information about the Soap