[Soap-Python] Complex types with quirks, declaring them in rpclib
Alex Railean
ralienpp at gmail.com
Wed Mar 21 14:52:44 CET 2012
Hi,
>> (3) 'use="required"' - the 'use' attribute is not declared in the
>> ...
> No, it isn't there. I actually didn't know about this. Why not just use
> min_occurs=1 ?
I think "use" is for attributes, whereas "min_occurs" is for elements.
http://www.w3.org/TR/xmlschema-0/#OccurrenceConstraints
I've done some digging in complex.py and I saw that the XmlAttribute
class has a describe() function that does look for a "use" argument.
Is this not the solution?
> class DigestAlgAndValueType(ComplexModel):
> DigestMethod = DigestMethodType
> DigestValue = DigestValueType.customize(min_occurs=1)
The call to customize() returns an object of DigestValueType and
overrides the min_occurs property with 1, right?
Why not just declare DigestValueType with min_occurs=1 from the very
beginning?
>> <xs:complexType name="DataType">
>> <xs:simpleContent>
>> <xs:extension base="xs:string">
>> <xs:attribute name="MimeType" type="xs:string" use="optional"/>
>> <xs:attribute name="Encoding" type="xs:string" use="optional"/>
>> </xs:extension>
>> </xs:simpleContent>
>> </xs:complexType>
>>
> You can't. Rpclib only supports simpleType extension via restrictions,
> not attributes.
Ok, I will try to simplify the problem then. Since those who will use
my server already have the WSDL, it is not critical for me to be able
to produce a WSDL that looks exactly like the one given in the
specifications.
However, it is critical for me to be able to receive such a request
and be able to handle it.
If I create a custom type like this, will it do the trick?
class DataType(ComplexModel):
class Attributes(ComplexModel.Attributes):
MimeType = XmlAttribute(String, use = 'optional')
Encoding = XmlAttribute(String, use = 'optional')
>> (2) how does rpclib handle 'namespace="##other"'?
> Rpclib can't generate this schema, you'd have to come up with a patch to
> the xml schema implementation that actually emits an <any/> tag.
I've examined the source and this seems to be the place to tinker
with: src\rpclib\interface\xml_schema\model\complex.py
But besides generating such a schema, there must also be a way to
represent such a structure in the custom type definition, which
happens here: rpclib\src\rpclib\model\complex.py
Can you confirm that this is the case?
In addition to that, it would be great if you could offer some
tips about implementing this. I am not yet familiar enough with the
guts of rpclib to be able to make such fundamental changes.
Alex
More information about the Soap
mailing list