I reused https://fedorahosted.org/suds/ticket/21 and adapted the code to use the idea. Change SUDS as shown below and use
Client.<method>(param1=value1, ... , attributes={'attrName1':'attrVal1'} )
to call the 'method' with the attribute 'attrName1' as desired.
--- a/website/suds/bindings/binding.py +++ b/website/suds/bindings/binding.py @@ -24,6 +24,7 @@ from suds.sax import Namespace from suds.sax.parser import Parser from suds.sax.document import Document from suds.sax.element import Element +from suds.sax.attribute import Attribute from suds.sudsobject import Factory, Object from suds.mx import Content from suds.mx.literal import Literal as MxLiteral @@ -101,7 +102,7 @@ class Binding: """ raise Exception, 'not implemented' - def get_message(self, method, args, kwargs): + def get_message(self, method, args, kwargs, attributes=None): """ Get the soap message for the specified method, args and soapheaders. This is the entry point for creating the outbound soap message. @@ -115,11 +116,23 @@ class Binding: @rtype: L{Document} """ + if attributes: + pass + # moved to suds/bindings/document.py + + #print method + #for name, val in attributes.items(): + # method.attributes.append(Attribute(name, val)) + + content = self.headercontent(method) header = self.header(content) - content = self.bodycontent(method, args, kwargs) + content = self.bodycontent(method, args, kwargs, attributes=attributes) body = self.body(content) env = self.envelope(header, body) + #if attributes: + # print content + # 1/0 if self.options().prefixes: body.normalizePrefixes() env.promotePrefixes() @@ -535,4 +548,4 @@ class PartElement(SchemaElement): return self else: return self.__resolved - \ No newline at end of file + diff --git a/website/suds/bindings/document.py b/website/suds/bindings/document.py index edd9422..0c84753 100644 --- a/website/suds/bindings/document.py +++ b/website/suds/bindings/document.py @@ -38,7 +38,7 @@ class Document(Binding): (multiple message parts), must present a I{document} view for that method. """ - def bodycontent(self, method, args, kwargs): + def bodycontent(self, method, args, kwargs, attributes=None):