I'd like this to be possible!
Can you write a web service (using C# and an asmx) that returns a ZIP file?
If so, can you give a simple example?
Thanks
-
Sure thing,
No matter if it's a ZIP, DOC, PDF. We call that MTOM in the SOAP world
-
This article shows how to return a file from webservice: http://articles.techrepublic.com.com/5100-10878_11-5805105.html.
-
I'm not sure you can use MTOM with vanilla .NET asmx services ( see here) . I know it's possible if using WCF though.
As a (poor) alternative, you could write a web method that returns the zipped data as a base64-encoded string (which would be probably quite long depending on the size of the file, so useful for small datasets only). Then you decode the string in the client to get the original data.
Tony Peterson : For sending the base64 encoding back to the caller, should the InsertLineBreaks option of Base64FormattingOptions be used?axel_c : I think you can get away with just Convert.ToBase64String (byte[] data). See http://msdn.microsoft.com/en-us/library/system.convert.tobase64string.aspx for details. -
Thanks empi, I've got it all working. Marvellous...
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.