[Fedora-suds-list] attachment support

Robert Marsanyi rnm at whidbey.com
Thu Dec 3 17:14:53 UTC 2009


I just used it Tuesday to send a gzip'd binary as an element in the request. 
The WSDL for that particular element was

<s:complexType name="OrderData">
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="DataType" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="DataValue" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="DataBinaryValue" 
type="s:base64Binary"/>
</s:sequence>
</s:complexType>

and the Python to set the element was

def zip_string( uncompressed_string ):
    " Given a string, use gzip and StringIO to create a zip'd string "
    zbuf = StringIO.StringIO()
    zfile = gzip.GzipFile(mode='wb', fileobj=zbuf)
    zfile.write( uncompressed_string )
    zfile.close()
    return zbuf.getvalue()

...
            .OrderData.DataBinaryValue = base64.b64encode( zip_string( 
line_xml ) )
...

which seemed to work well.

--rbt


----- Original Message ----- 
From: Ajai Joy
To: fedora-suds-list at redhat.com
Sent: Thursday, December 03, 2009 5:51 AM
Subject: [Fedora-suds-list] attachment support


Does suds, have attachment support - either MTOM or base64 encoded 
attachments ? If so, could anyone share some samples?

Thanks
AJ




_______________________________________________
fedora-suds-list mailing list
fedora-suds-list at redhat.com
https://www.redhat.com/mailman/listinfo/fedora-suds-list 




More information about the suds mailing list