Compatibility with .NET GZipStream class? - WeOnlyDo Discussion board

Compatibility with .NET GZipStream class? (General questions)

by Paco Lianez, Monday, November 26, 2007, 17:32 (6207 days ago)

I have a C# WebService that returns a GZip compressed string in Base64. The code is:
...
[WebService(Namespace= http:... )]
public class WebSvc{

[WebMethod]
public string GetData() {

string text = Text to compress ;

byte[] buffer = Encoding.ASCII.GetBytes(text);
MemoryStream ms = new MemoryStream();
using (GZipStream zip = new GZipStream(ms, CompressionMode.Compress, true))
{
zip.Write(buffer, 0, buffer.Length);
zip.Close();
}

ms.Position = 0;
MemoryStream outStream = new MemoryStream();

byte[] compressed = new byte[ms.Length];
ms.Read(compressed, 0, compressed.Length);

return Convert.ToBase64String(compressed);

}


In the client (a VB6 app), I call the WebService(with wodHttpDLX), extract the string from de XML (GetDataResult)and I want to decompress it with wodCrypt. The code:

Dim org as New MemBlob
Dim dst As New MemBlob
Dim zip As New wodCryptCom

zip.Type = None
zip.Compression = GZipCompression

org.FromBase64(GetDataResult)
zip.Decrypt org, dst <-- In this point I get error Failed to decompress data

Any ideas?

Thanks


Re: Compatibility with .NET GZipStream class?

by wodDamir, Monday, November 26, 2007, 18:53 (6207 days ago) @ Paco Lianez

Hi Paco,

Please try the following code in VB6:
--------------------------------------------
Set crypt = New wodCryptCom
Set i_blob = New MemBlob
Set o_blob = New MemBlob

crypt.Type = None
crypt.Compression = GZipCompression
crypt.Optimized = False
i_blob.FromBase64 ( String received from .Net )
crypt.Decrypt i_blob, o_blob
--------------------------------------------

I've tried on my side, and it worked like a charm.

Hope I helped.

Regards,
Damba

Re: Compatibility with .NET GZipStream class?

by Paco Lianez, Monday, November 26, 2007, 19:07 (6207 days ago) @ wodDamir

Works ok with version 1.2.7.25

Again excellent support!!

Thanks