What is faster: web service or XML server output?
The Central Bank of Russia as any other central bank provides a service to get exchange rates between ruble a number of other world currencies.
Web service: http://www.cbr.ru/DailyInfoWebServ/DailyInfo.asmx
XML output: http://www.cbr.ru/scripts/XML_daily.asp?date_req=25/11开发者_运维百科/2009
.NET can easily read both. But what is faster and more reliable? Which could you recommend to choose?
btw, European Central Bank provides only XML output and only for today: http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml
Since they both come from the same source they are both just as likely to be reliable. As for speed it would be impossible to tell and is likely to fluctuate due to environmental variables that cannot be known from your question alone.
As with all things - code the solution that is the clearest, easiest to read, and easiest to maintain. Then, if performance becomes and issue, profile your application to determine if this data feed is the source of your performance problem. Then, if you have verified that it is in fact the source of the performance problem then begin investigating ways to improve the performance.
All things being equal, I would speculate that these two data feeds would be retrieved and read by your application at similar speeds.
Any day XML is faster and most recommended.
Well, the XML version will be "faster", but it won't be the main cause of your speed issues anyway, so just go with whatever is easier.
As for more reliable, well, it's up to them anyway, but it depends on how you care. I mean, the webservice means you don't need to do any xml processing yourself, so you may consider that more "reliable", but then perhaps the XML format doesn't change that often, and they may at one point upgrade the webservice, so in this case the xml is more "reliable".
Thus, on both points, just go with what you find easiest and fastest and more reliable to write for you. Only you can decide that.
精彩评论