[spyne] defining a service without expecting namespace in every tag

Daniele Bortoluzzi daniele at elkos.it
Mon Aug 10 16:12:19 UTC 2015


Dear Spyne users,

I am setting up a SOAP service implementing a predefined WSDL. I cannot
tell Spyne not to expect a namespace in every tag of the input XML.

This is what "their" client sends with their WSDL:

<SOAP-ENV:Envelope xmlns:ns1="myNameSpace" PLUS_LOTS_OF_ATTRIBUTES>
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:NotifyRequest>
         <mytag1>020.010</mytag1>
         <notifications>
            <item>
               <subtag1>OK</subtag1>
               <subtag2>OKAC</subtag2>
            </item>
         </notifications>
      </ns1:NotifyRequest>
   </ns0:Body>
</SOAP-ENV:Envelope>

and this is what my test client would send with the Spyne-generated WSDL:

<SOAP-ENV:Envelope xmlns:ns1="myNameSpace" PLUS_LOTS_OF_ATTRIBUTES>
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:NotifyRequest>
         <ns1:mytag1>020.010</ns1:mytag1>
         <ns1:notifications>
            <ns1:item>
               <ns1:subtag1>OK</ns1:subtag1>
               <ns1:subtag2>OKAC</ns1:subtag2>
            </ns1:item>
         </ns1:notifications>
      </ns1:NotifyRequest>
   </ns0:Body>
</SOAP-ENV:Envelope>

"ns1" is everywhere and I don't know how to get rid of it.

Moreover, if I don't set a __namespace__ attribute on my custom
ComplexModel input objects, the WSDL shows the module name (e.g. the file
in which I defined the custom objects) as the namespace.

I am using the @rpc decorator as follows:

import spyne.const
spyne.const.REQUEST_SUFFIX = 'Request'

@rpc(NotifyReq, _returns=NotifyResponseMessage)
def Notify(ctx, n_req):
     return ctrl.read_notify_response(n_req)

these are the models involved:

DEFAULT_NS = "myNameSpace"

class StatusNotification(ComplexModel):
    __namespace__ = DEFAULT_NS
    subtag1 = Unicode
    subtag2 = Unicode

    class Attributes(ComplexModel.Attributes):
        max_occurs = 1
        min_occurs = 1


class NotifyReq(ComplexModel):
    __namespace__ = DEFAULT_NS
    mytag1 = Unicode
    notifications = Array(StatusNotification,
        member_name='item').customize(min_occurs=1)


What am I missing?

Thank you in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spyne.io/archives/people/attachments/20150810/ba18f312/attachment.html>


More information about the people mailing list