[Fedora-suds-list] attachment support

Ajai JOY ajai.joy at gmail.com
Mon Dec 7 18:07:15 UTC 2009


Robert,
I am able to wire the attachment, but the contents does not seem to be
correct, I am wiring the binary to an axis engine in java. Basically my
service call, needs a csv file with contents as below (first row being a
string "NAME" and the second row being "machine1" etc)

NAME
machine1

Here is the method :

def zip_string():
#" Given a string, use gzip and StringIO to create a zip'd string "
    uncompressed_string_header  ="NAME\n"
    uncompressed_string_contents ="machine1"
    zbuf = StringIO.StringIO()
    zfile = gzip.GzipFile(mode='wb', fileobj=zbuf)
    zfile.write( uncompressed_string_header )
    zfile.write( uncompressed_string_contents )
    zfile.close()
    return zbuf.getvalue()

//service call
client.service.executeCommand('some string',  base64.b64encode(
zip_string()))


Any ideas?

Thanks
AJ

>
> ------------------------------
>
>    - *From*: "Robert Marsanyi" <rnm whidbey com>
>    - *To*: <fedora-suds-list redhat com>
>    - *Subject*: Re: [Fedora-suds-list] attachment support
>    - *Date*: Thu, 3 Dec 2009 09:14:53 -0800
>
> ------------------------------
>
> 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 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
>
>
>
> --
> Best Regards,
> Ajai Joy
>



-- 
Best Regards,
Ajai Joy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.fedoraproject.org/pipermail/suds/attachments/20091207/840f70ec/attachment.html 


More information about the suds mailing list