I have an API of Web Service, which has a long response time in some cases. What should I show instead of a regular loading image to keep the users feel good (so that users do not get frustrated)?
The above is a example of what most website did when loading their page.
There's many approaches to this, but my take is that instead of showing a big loading images, what you can do is to load the wireframe first which should not take long, while loading the content at the background.
With this approach, there's at least 2 advantage over the traditional approach.
I believe your user will feel better. =) Cheers.
It depends on whether the action is blocking or non-blocking, and on the response time expected. Some good resource is the following article: http://www.nngroup.com/articles/response-times-3-important-limits/
Basically if the wait time is below 10 second, a blocking loading dialog is acceptable. If the time is above that, or the action is non-blocking then the user should be allowed to run the action in background, and perform other actions while waiting.
One possibility is to show the loading progress bar, with a button saying "run in background", below is an example from Eclipse.