Week 10 of Internet Application Development was unfortunately a missed class for me. The lecture moved from data stores to web services.
The obvious place to start is with a definition of web service (source week 10 lecture notes):
A web service is a component of programmable application logic that can be accessed using standard web protocols.
XML comes unto its own in the web services field and ASP.NET does not deviate from the industry gravitation to XML.
Keeping with the practical flavor of the unit, we go straight into some examples:
<pre><%@ WebService Language="c#"%>
public class Greetings
[WebMethod] public string Hello(string strName)
return "Hello, " + strName + ". Welcome to my web service";
The client options of GET and POST were briefly explored, but SOAP (http://en.wikipedia.org/wiki/SOAP)
SOAP is important as alot of the time we want to pass something more complex than strings to a web service.
Four essential parts of web services:
- Processing directive
- Public class
- web-callable methods
An example of creating a web service as an intermediary between a data store and external client came next. A real life example of this is rental reseller programs, affiliates of companies such as hertz utilize hertz’s web services to check for car availability and then book a car.
The final step was walkthrough for integrating web services with ASP.NET
- The application executes a function, whose code is actually in the web service.
- The proxy takes the call, formulates the request to the web service, using the parameters specifeid.
- The function call is sent from the proxy to the web service, which might be on the same machine, across a local network, or across the internet.
- The web service uses the parameters to execute its web-callable function, and build the result in XML
- The resulting data is returned from the web service to the proxy
- The proxy parses the XML returned to retrieve the individual values generated.
- The application receives these values from the proxy.