A Web service (also Webservice ) is defined by the W3C as "a software system designed to support interoperable machine-to-machine interaction over a network . It has an interface described in a machine-processable format (specifically WSDL ). Other systems interact with the Web service in a manner prescribed by its description using SOAP-messages, typically conveyed using HTTP with an XML serialization in conjunction with other Web-related standards."
简单的说就是通过接口技术来支持机器与机器之间的基于网络环境下的互操作。像CORBA,DCOM和EMI也可以实现类似的功能。
要理解Web service 还需要理解下列概念:
- SOAP
- WSDL
- XML
- XML schema language, like XML Schema(XSD), DTD
- REST
- SOA
实现Web service 有3中主流方式:RPC, SOA, REST。RPC因为不是loose coupling,现在用的不多。后两者都是loose coupling,采用HTTP作为传输层。SOA采用SOAP/WSDL组合,很多时候也用SOAP来称呼这种方;而REST将操作(operation)绑定HTTP标准操作上,如GET, POST, PUT, DELETE for HTTP),目前大有取代SOA的趋势。
那么就主要比较一下后两者的:
REST web services are:
- Lightweight - not a lot of extra xml markup
- Human Readable Results
- Easy to build - no toolkits required
SOAP also has some advantages:
- Easy to consume - sometimes
- Rigid - type checking, adheres to a contract
- Development tools
目前美国大的网络服务商都提供Web service ,如Amazon, Google, Yahoo!, Bing, eBay, Bestbuy等。
参考:
【1】http://en.wikipedia.org/wiki/Web_service
【2】http://en.wikipedia.org/wiki/SOAP_(protocol)
【3】http://en.wikipedia.org/wiki/Web_Services_Description_Language
【4】http://en.wikipedia.org/wiki/XML
【5】http://en.wikipedia.org/wiki/Xml_schema
【6】http://en.wikipedia.org/wiki/Representational_State_Transfer
【7】http://en.wikipedia.org/wiki/Service-oriented_architecture
【8】http://www.petefreitag.com/item/431.cfm
【9】http://www.ajaxonomy.com/2008/xml/web-services-part-1-soap-vs-rest
【10】http://www.prescod.net/rest/rest_vs_soap_overview/