5

The LA Fox Developer Newsletter
December 2000
“.NET” (Con? from page 4)
ASP+ Web Services
The ASP+ Web Services infrastructure provides a high-level programming model for building Web Services with ASP+. While not required for building a Web Service using the Web Services Platform, it provides several benefits that simplify development and uses a programming model that will be very familiar to developers who have worked with ASP or Visual Basic. Developers don’t need to understand HTTP, SOAP, SCL, or any other specifications for Web Services to use this programming model. The ASP+ Web Services programming model is shown in Figure 6.


Figure 6 ASP+ Web Services

Developers can create a Web Service with ASP+ by authoring a file with the extension .asmx and deploying it as part of a Web application. The ASMX file either contains a reference to a managed class defined elsewhere or the class definition itself. The class is derived from the WebService class supplied by ASP+. Public class methods are exposed as Web Service methods by marking them with the WebMethod attribute. These methods can be invoked by sending HTTP requests to the URL
of the ASMX file. You don’t need to handcraft a contract for your Web Service. ASP+ inspects the class metadata to automatically generate an SCL file when requested by the caller.

Clients may submit service requests via SOAP, HTTP GET, and HTTP POST. Conventions are defined for encoding methods and parameters as query strings for HTTP GET and form data for HTTP POST. The HTTP GET and HTTP POST mechanisms are not as powerful as SOAP, but they enable clients that don’t support SOAP to access the Web Service.

The ASP+ Web Services model assumes a stateless service architecture. Stateless architectures are generally more scalable than stateful architectures. Each time a service request is received, a new object is created, the request is converted into a method call, and the object is destroyed once the method call returns. Services can use the ASP+ State Management services if they need to maintain state across requests. Web Services based on ASP+ run in the Web application model, so they get all the security, deployment, and other benefits of that model.

ASP+ Web Services also supplies a tool to generate strongly typed managed proxies for any Web Service described by an SCL file. The proxy generator maps messages described in the SCL file into methods on the generated class. The proxy hides all the network and marshaling plumbing from the application code, so using the Web Service looks just like using any other managed code. The proxy will preferentially use SOAP to communicate with the Web Service, but also supports the HTTP GET and HTTP POST mechanisms, so they can be used as well.

Conclusion
Web Services provide a simple, flexible, standards-based model for binding applications together over the Internet that takes advantage of existing infrastructure and applications. Web applications can be easily assembled with locally developed services and existing services, irrespective of the platform, development language, or object model used to implement any of the constituent services or applications.

The Microsoft .NET Framework provides an application model and key enabling technologies to simplify the creation, deployment, and ongoing evolution of secure, reliable, scalable, highly available Web Services while building on existing developer skills.


[Maty Kirtland is part of the MSDNArchitecture team, where she helps create pra ctical guidance for developers who design applications using Microsoft technologies. She is the author of Designing Component-based Applications (Microsoft Press, 1998).]

2000 Microsoft Corporation. All rights reserved. Terms of Use. Privacy Policy.
Page 5

5