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)