Chapter 19: Exposing Web Services


Overview

Web services aren't a new concept. They allow distributed applications to share business logic over a network. A classic web service example scenario is a stock quote service: one company provides a service that can accept requests for stock symbols and responds with stock quote details. A company building an investment site can then use the application logic provided by the stock quote company to retrieve stock quote details.

This problem sounds relatively simple, but has proven quite difficult to solve in the past. That's largely due to proprietary protocol formats, such as RMI, and the lock-down of open ports to only port 80 (for HTTP) and port 443 (for HTTPS).

What is new is the use of XML and HTTP, which are open standards, rather than proprietary serialization formats such as DCOM, RMI, or CORBA (although CORBA isn't proprietary, each vendor's CORBA implementation is unique to the vendor).

By using standard Web protocols such as HTTP, and data description languages such as XML, to exchange data over common ports, web services can utilize the ubiquitous HTTP infrastructure support that is already in place.

The technical definition of a web service is programmable application logic accessible via standard Web protocols. Behind this definition are two important points:

  • Programmable application logic :Web service is non-specific to implementation. The application logic can be implemented by components , by Perl scripts, or by any other mechanism that supports XML.

  • Standard web protocols :Web services use Internet transport protocols such as HTTP or SMTP. The union of XML and HTTP forms Simple Object Access Protocol ( SOAP ). SOAP is a W3C submitted note (as of May 2000) that uses HTTP and XML to encode and transmit application data.

Consumers of a web service don't need to know anything about the platform, object model, or programming language used to implement the service; they only need to understand how to send and receive SOAP messages.

ASP.NET makes building web services easy, and since it uses the standard ASP development model, ASP developers already have the skills required to build web services with ASP.NET. Although a web service makes use of XML and HTTP as part of the plumbing, ASP.NET abstracts this and makes building SOAP-based end-points as simple as coding application logic. The plumbing is still accessible if you need to work with the transport or serialization mechanisms for some reason.

Here's what we'll cover in this chapter:

  • We'll start with an overview of what a web service is, look at some of the common problems associated with building distributed applications, and briefly discuss the public specifications used for building web services.

  • We'll look at how we build web services with ASP.NET, starting with enabling some simple application logic, and going on to look at the additional attributes and classes you can use when creating ASP.NET web services.

  • ASP.NET web services support three protocols for exchanging data through a web service HTTP GET and POST, and SOAP. We'll look at these protocols and the supported data types.

  • We'll look at some strategies for building web services and tracing web service requests, as well as how to build services that operate asynchronously on the server. We'll also look at some of the general ASP.NET features that we can leverage.

Let's get started with an overview of web services.

Important

In this chapter, any discussion of web services implies the use of SOAP unless otherwise stated.




Professional ASP. NET 1.1
Professional ASP.NET MVC 1.0 (Wrox Programmer to Programmer)
ISBN: 0470384611
EAN: 2147483647
Year: 2006
Pages: 243

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net