Amit's Blog

Sharing Thoughts and Learning

  Home  |   Contact  |   Syndication    |   Login
  43 Posts | 0 Stories | 233 Comments | 14 Trackbacks

News

About Me?
Read it in
Blog Statistics
Proud Member of

Tag Cloud


Archives

Post Categories

Articles

Book Review

I Visit.

OpenSource Project(s)

Web Service

In this post, I will show you how to compress the Asp.net Ajax Web Service response, To understand the benefits of compression let us start with a simple example, Consider you have an web service which returns a large data like the following:[WebMethod()] public string GetLargeData() { using (StreamReader sr = File.OpenText(Server.MapPat... { return sr.ReadToEnd(); } } The web method reads an large text file (around 100KB) and returns it contents. Once we call this method from a...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Asp.net 2.0 has a built-in feature for creating multi-threaded page AKA AsyncPage, but for Web Service threading, there are no out of the box support. The following code snippet will show you how to create a multi-threaded web service. For the sake of the example, let us assume that we are creating Video Search Service, which will search different sites such as YouTube, MetaCafe, and DailyMotion for a given keyword and returns a composite result. Since this search can be done independently, we can...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

Recently I wrote an article "How to exchange data securely with a WebService without HTTPS/SSL" in codeproject. If Cryptography, Public/Private Key, Digital Signature and Web Service are one of your interest, I strongly recommend to read it...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati

When consuming any external service, don't expect the external service developer is as much smart as you are. Recently I have faced an issue when integrating with Amazon S3 that they failed to serve the data on first request, but on the consequent request they are able to return the data. So I did a little tweak in my code, instead of calling the service once, I am retrying up to 3 times. If the retry also fails the regular code block executes: const int MAX_TRY = 3;int tryCount = 1;byte[] result...
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati