1

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.

Danielle Madeley
  • 2,616
  • 1
  • 19
  • 26

1 Answers1

2

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.

Koterpillar
  • 7,883
  • 2
  • 25
  • 41
  • That's correct, but I'd suggest doing `rpcCall = NS2RPCCall.customize(sub_ns="NS2")` inline within the parent (in this case: `NS1Data`) object. – Burak Arslan Apr 24 '15 at 07:45