Greetings; brand-new to SOAP, brand-new to the suds library, I hope I use the correct terms to describe my problem.<br><div><br></div><div>Executive summary: I need to send elements with leading underscores in their names but they are modified/dropped by suds.</div>
<div><br></div><div>1: Why does the code modify element names with leading underscores? e.g. '__limit' becomes '_limit' (or is it '@_limit')</div><div>2: is there a workaround?</div><div><br></div>
<div><br></div><div><br></div><div>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 </div><div>is "Document/Literal". So far I'm doing fine just calling the service ]= RPC-style:</div>
<div><br></div><div>>>> client = Client(url, transport)</div><div>>>></div><div>>>> rslt = client.service.getKeys(name='foo')</div><div>>>></div><div><br></div><div>However, for some of my queries, I need to set/send parameters with names that have leading underscores. But, I have found </div>
<div>that the appenders deliberately modify these names and do something other than expected (by myself, at least) with the </div><div>values. Thus, they are just dropped.</div><div><br></div><div><br></div><div>This example </div>
<div>below is my experiment in injecting raw SOAP with __inject, and it worked fine:</div><div><br></div><div><div>msg2 = """\</div><div><?xml version="1.0" encoding="UTF-8"?></div>
<div><SOAP-ENV:Envelope xmlns:ns0="<a href="http://www.service-now.com/sys_journal_field">http://www.service-now.com/sys_journal_field</a>" </div><div> xmlns:ns1="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>" </div>
<div> xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" </div><div> xmlns:SOAP-ENV="<a href="http://schemas.xmlsoap.org/soap/envelope/">http://schemas.xmlsoap.org/soap/envelope/</a>"> <SOAP-ENV:Header/></div>
<div> <ns1:Body></div><div> <ns0:getKeys></div><div> <ns0:name>NOYB</ns0:name></div><div> <ns0:__limit>1</ns0:__limit></div><div> </ns0:getKeys></div><div>
</ns1:Body></div><div></SOAP-ENV:Envelope></div><div>"""</div></div><div><br></div><div>But if I send "client.service.getKeys(name='foo', __limit=1)", it hits this code:</div>
<div><br></div><div> <a href="https://fedorahosted.org/suds/browser/trunk/suds/mx/appender.py#L191">https://fedorahosted.org/suds/browser/trunk/suds/mx/appender.py#L191</a></div><div><br></div><div>Even more interesting (and what makes me think that it's a logical bug) is that this is preventing me from using a </div>
<div>message created from the WSDL:</div><div><br></div><div><div>>>> getKeysMessage = uut.factory.create('tns:getKeys')</div><div>>>> print getKeysMessage</div><div>(getKeys){</div><div> element = None</div>
<div> element_id = None</div><div> name = None</div><div> sys_created_by = None</div><div> sys_created_on = None</div><div> value = None</div><div> __use_view = None</div><div> __encoded_query = None</div><div>
__limit = None</div><div> __first_row = None</div><div> __last_row = None</div><div> }</div></div><div><br></div><div><div> File "/usr/lib/python2.6/site-packages/suds/mx/core.py", line 88, in append</div>
<div> self.appender.append(parent, content)</div><div> File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 118, in append</div><div> appender.append(parent, content)</div><div> File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 275, in append</div>
<div> Appender.append(self, child, cont)</div><div> File "/usr/lib/python2.6/site-packages/suds/mx/appender.py", line 200, in append</div><div> self.marshaller.append(parent, content)</div><div> File "/usr/lib/python2.6/site-packages/suds/mx/core.py", line 87, in append</div>
<div> if self.start(content):</div><div> File "/usr/lib/python2.6/site-packages/suds/mx/literal.py", line 102, in start</div><div> raise TypeNotFound(content.tag)</div><div>TypeNotFound: Type not found: '__use_view'</div>
<div><br></div><div><br></div><div><br></div></div><div>If I delattr all of the elements with leading underscores, then calling the method with that object works just fine.</div><div><br></div><div>Can anyone explain what's going on? Why is startswith('_') looked for in the code? What's the workaround?</div>
<div><br></div><div>Thanks!</div><div><br></div><div><br></div>