Sunday, April 20, 2008

I was porting some code to WSE 3 and had to look for a new method of compressing my web service requests and response.  It seems there are many options to handle compressing a response and decompressing it on the client but they all seem to overlook at the web service request.  They can be almost as large as a response and would benefit tremendously from compression.  So this weekend I threw together a HttpModule that could handle compressing the web service response and handle incoming compressed requests.  I also have the custom WebRequest and WebResponse classes for handling the compression on the client side.

Client side usage.

In your web service proxy class overload the GetWebRequest

partial class TestService : System.Web.Services.Protocols.SoapHttpClientProtocol 
{
    protected override System.Net.WebRequest GetWebRequest( System.Uri uri )
   {
      return new MicroFischCompress.CompressWebRequest( System.Net.WebRequest.Create( uri ), true);
   }
}
 
 WebServiceCompression.zip (147.02 KB)
posted by Aaron Fischer on Sunday, April 20, 2008 7:03:58 PM (Pacific Standard Time, UTC-08:00)   #    Comments [0]
Name
E-mail
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, super, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview