I'm trying to receive and generate messages that can have the following schema:
<ns1:data>
<ns1:status-change/>
<ns2:rpc-call/>
</ns1:data>
I then have:
class NS1ComplexModel(ComplexModel):
__namespace__ = 'ns1'
class NS1Data(NS1ComplexModel):
statusChange = NS1StatusChange
rpcCall = NS2RPCCall
class NS1StatusChange(NS1ComplexModel):
...
But the outcome of this is that has the namespace of ns1
and not ns2
.
I've been looking through resolve_namespace()
and friends and I think I see what's causing it but I can't work out how to fix it or even work around it.
I think this is the same problem I'm having, and I solved it by defining
class NS2RPCCall(NS2ComplexModel):
class Attributes(NS2ComplexModel.Attributes):
sub_ns = NS1ComplexModel.__namespace__
This is from looking at spyne.protocol.xml.XmlDocument._get_members_etree
and spyne.model.complex._gen_attrs
.