[Fedora-suds-list] Element names with leading underscores .. story?

David Carmean dlcarmean at gmail.com
Thu Oct 6 12:40:25 UTC 2011

Greetings; brand-new to SOAP, brand-new to the suds library, I hope I use
the correct terms to describe my problem.

Executive summary: I need to send elements with leading underscores in their
names but they are modified/dropped by suds.

1: Why does the code modify element names with leading underscores?  e.g.
'__limit' becomes '_limit' (or is it '@_limit')
2: is there a workaround?

I have a service which, in general, is working fine with suds as a client.
 The vendor's docs tell me that the message style
is "Document/Literal".   So far I'm doing fine just calling the service ]=

>>> client = Client(url, transport)
>>> rslt = client.service.getKeys(name='foo')

However, for some of my queries, I need to set/send parameters with names
that have leading underscores.  But, I have found
that the appenders deliberately modify these names and do something other
than expected (by myself, at least) with the
values.  Thus, they are just dropped.

This example
below is my experiment in injecting raw SOAP with __inject, and it worked

msg2 = """\
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://www.service-now.com/sys_journal_field"

But if I send "client.service.getKeys(name='foo', __limit=1)", it hits this


Even more interesting (and what makes me think that it's a logical bug) is
that this is preventing me from using a
message created from the WSDL:

>>> getKeysMessage = uut.factory.create('tns:getKeys')
>>> print getKeysMessage
   element = None
   element_id = None
   name = None
   sys_created_by = None
   sys_created_on = None
   value = None
   __use_view = None
   __encoded_query = None
   __limit = None
   __first_row = None
   __last_row = None

  File "/usr/lib/python2.6/site-packages/suds/mx/core.py", line 88, in
    self.appender.append(parent, content)
  File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 118, in
    appender.append(parent, content)
  File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 275, in
    Appender.append(self, child, cont)
  File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 200, in
    self.marshaller.append(parent, content)
  File "/usr/lib/python2.6/site-packages/suds/mx/core.py", line 87, in
    if self.start(content):
  File "/usr/lib/python2.6/site-packages/suds/mx/literal.py", line 102, in
    raise TypeNotFound(content.tag)
TypeNotFound: Type not found: '__use_view'

If I delattr all of the elements with leading underscores, then calling the
method with that object works just fine.

Can anyone explain what's going on?  Why is startswith('_') looked for in
the code?  What's the workaround?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20111006/33f6cbb6/attachment.html 

More information about the suds mailing list