Originally posted by Ulf Dittmer: Web service is the more general term. While "web" always implies "HTTP", the payload need not be XML (although it often is). Plain text or JSON might also be sent.
A subdivision of "XML over HTTP" is SOAP vs. REST.
Thanks. Does that mean it is safe to say that a webservice is XML over HTTP?
Joined: Aug 19, 2005
Does that mean it is safe to say that a webservice is XML over HTTP?
No. As Ulf already pointed out a web service can deal with any content-type, not just XML. Right now, in the majority of cases "web service" actually means "SOAP Web Service" though strictly speaking that is incorrect.
"XML over HTTP" classifies as a web service. HTML sent by a web server is meant to be interpreted by a browser which performs the layout of the information for human consumption. Programs have always been used for screen scraping to obtain needed information. However it's easier to extract information from meta-data (XML) tags than from (HTML) layout tags (XHTML5 can serve both needs). So the idea that applications submit and retrieve data over the web in XML is captured in "XML over HTTP".
XML-RPC was an early and quick web service formalization of "XML over HTTP" for the purpose of making remote procedure calls.
SOAP is XML and SOAP web services receive and send SOAP messages over HTTP. However the SOAP protocol aims to be transport agnostic so that it can use transports other than HTTP (which would still be SOAP but no longer a web service). This means that it cannot use the HTTP protocol to its full potential - it basically "tunnels" though it. SOAP is a specialization of "XML over HTTP" as long no attachments are involved. Once a SOAP envelope is used in combination with attachments (which still classifies as SOAP in general) the HTTP payload is a MIME envelope rather than XML.
RESTful web services do not place any restrictions on the content-type of the HTTP request/response. The content-type could be XML but it doesn't have to be. However REST embraces the HTTP protocol and the original design principles of the web which is "resource" based. Sometimes it is assumed that "using HTTP" means being RESTful - it doesn't.
Then there are web services that don't meet any of the above criteria. For example some RIA support web services exchange JSON but don't follow REST design principles. [ February 05, 2008: Message edited by: Peer Reynders ]