There’s a known solution to enable HTTP 1.1 Compression for Web Services that’s been described on dotnetjunkies site. The solution that they propose is to override GetWebRequest and GetWebResponse methods in your WS generated proxy file. If you’d try to implement this solution for CF you’d get an “no suitable method found to override" exception. The problem is that Microsoft “forgot” to expose these methods as overridable in the WebClientProtocol class in the v1 of CF, but… they have silently updated the WebClientProtocol class to expose the GetWebRequest and GetWebResponse as virtual (overridable) methods in one of the Service Packs.
So, in order to be able to compile the sample from dotnetjunlies, you'd need to update the System.Web.dll in the \CompactFrameworkSDK\v1.0.5000\Windows CE directory. Here's the tricky part. The steps are:
1. Download the CF SP2 developer redistributable:
http://www.microsoft.com/downloads/details.aspx?familyid=10600643-09b3-46d8-ba28-bc494bc20d26&displaylang=en
2. Unpack one of the CAB's from the distribution (I've used WinRAR to unpack the netcf.core.ppc3.x86.CAB file).
3. Rename the SYC6B2~1.014 file to System.Web.dll
4. Copy it to the fore mentioned directory.
Here you go, now you should be able to modify the web service proxy files to use using Standard HTTP 1.1 Compression.
Oh… and also make sure you’re running the SP2 bits on the device as well.
I’ve put together a CF sample that includes SharpZipLib and the code from the article. The sample uses the StockService sample Web Service from WSE 2.0 distribution.
You can download the sample here.
WSCompression.zip (226.13 KB)