I have an aspx page which reads items from an SQL DB and displays them on a GridView. For every item located in DB there are several metadata associated with it which can be retrieved by making a Web Service call per item in the GridView. What I want to do is to make concurrent calls to the web-se开发者_JAVA技巧rvice (in order to save time from sequential calls) and fill these metadata in the GridView. Any ideas ?
Thank you, Dimitris
As mentioned you have 2 options. One would be to use client side ajax to fetch the data after the page has loaded. The other option would be to use an asynchronous httpwebrequest and fetch the data before the page loads.
If possible given your security requirements as well as functionality requirements, I think ajax is the better way to go. It will put less load on your servers.
To elaborate: After your page loads, if possible, have the client call the webservice directly, completely bypassing your servers. This is likely to be the fastest seeming option, especially if you have many items to get data for. The first few will load quickly, and the user won't notice that the rest are loading while they are busy with the first few.
Alternately, if security is an issue (your webservice has credentials you don't want the world to know), you might want to proxy off your server, having your server return the results from the webservice, which the client asks for via ajax.
精彩评论