[Fedora-suds-list] two prefixes "ns1" and "SOAP-ENV" for same namespace

Luc Saffre luc.saffre at gmail.com
Tue May 15 21:30:00 UTC 2012


Hi,

this is my first post to this list. I discovered SUDS recently and start
to like more and more... thanks for your work!

I wondered why SUDS uses two different prefixes "ns1" and "SOAP-ENV" for
the namespace "http://schemas.xmlsoap.org/soap/envelope/"::

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope ...
  xmlns:ns1="http://schemas.xmlsoap.org/soap/envelope/"  ...
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns1:Body>
      ...
   </ns1:Body>
</SOAP-ENV:Envelope>

Okay it is valid XML, but it's not very elegant. And there is at least
one problem report that seems to be caused by some parser that doesn't
like it: http://stackoverflow.com/questions/4605687/invalid-suds-envelope

I fixed this strange behaviour very easily (at least AFAICS), by
changing one word in suds/bindings/binding.py, method get_message()

        if self.options().prefixes:
            env.normalizePrefixes()
            #~ body.normalizePrefixes()
            env.promotePrefixes()
        else:
            env.refitPrefixes()

So I suggest to fix this in the trunk (unless I missed something, which
is not impossible since I am rather new to XML and SOAP. In that case
I'd be glad if one of you finds a few words to explain it to me).

Luc


More information about the suds mailing list