- Web services are services provided over the web using standard technologies such as XML, a W3C standard.
- Any application on any platform can consume a web service as long as it is able to understand XML.
- XML is text based, thus it is quick and easy to download and even easier to use.
- To consume an ASP.NET web service, look for an .asmx file.
- An example of a web service is http://www.webservicex.net/ConvertTemperature.asmx.
- There are 3 methods used to communicate with a web service: HTTP-GET, HTTP-POST, and SOAP.
- In HTTP GET and POST, the response body is an XML. Below is an example response from the ConvertTemperature web service mentioned above, converting 21.5 degrees Celcius to degrees Farenheit.
- SOAP (Simple Object Access Protocol) is basically a well-formed XML created just for the purpose of sending requests and receiving responses to and from the web service.
- A SOAP request is wrapped in an HTTP-POST. The example below is the SOAP request sent to the ConvertTemperature web service, separated into a request header and request body:
- The corresponding SOAP response is below (response header not shown):
- In the SOAP request and response body, you need to have at the minimum the SOAP tags <Envelope> and <Body>. You can also have the optional SOAP tag <Header>. Inside the <Body> SOAP tag contains other tags that are specific to the web service.
In my next post, I will talk about what is required to create a web service in ASP.NET.