目前网络上有一些基于Web发布的Service接口,此处不一定特指基于SOAP的Web Service接口。大多时候我更喜欢暴露出一个URL,开发者传入查询参数返回XML或者jason数据的接口。比如:
1. Wiki接口
http://en.wiktionary.org/w/api.php?action=query&prop=revisions&titles=%s&rvprop=content&format=json
此处titles参数可以是任何Word,一个特殊的格式返回某天的特定单词是 Wiktionary:Word of the day/October 26
需要注意的是调用是需要通过Javascript的encodeURI或者encodeURLComponent进行编码。
Wiktionary:Word of the day/October 26编码成一下两种都可以
encodeURL:
Wiktionary:Word%20of%20the%20day/October%2021
貌似是escape 或者 encodeURLComponent:
Wiktionary%3AWord+of+the+day%2FOctober+21
2. Google 天气
http://www.google.com/ig/api?weather=%s&hl=zh-cn
中国地区,weather参数可以是城市的拼音。如上海未来三天的天气预报:
http://www.google.com/ig/api?weather=shanghai&hl=zh-cn
3. Yahoo 财经(股票数据)
返回的是CSV格式的。
http://download.finance.yahoo.com/d/quotes.csv?f=sl1d1t1ohgv&e=.csv&s=IBM,NOK,HMC
4.Wikipedia
需要解析返回的网页文件(右侧的信息框,是一些三元组),不是直接的Web service接口
http://en.wikipedia.org/wiki/Nokia
返回的是网页,三元组形式
5. Google Reader RSS export
https://www.google.com/reader/atom/feed/http://echohfut.iteye.com/rss?n=150
URL 中feed后面可以是其他RSS URL