Chapter 6: Writing Optimized Web Services


Overview

Web services are distributed components that communicate using standard protocols such as Simple Object Access Protocol (SOAP) and Hypertext Transfer Protocol (HTTP) over Transmission Control Protocol/Internet Protocol (TCP/IP). Web services are flexible and robust because they operate in a loosely coupled environment using reliable, industry-standard communication mechanisms. Web services are self-documenting because they publish details of their interface using an Extensible Markup Language (XML) vocabulary called the Web Services Description Language (WSDL). In addition, you build Web services with bindings to documented namespaces that serve as a point of reference for the Web service methods . These technologies enable Web service components to evolve over time in a self-documenting manner that minimizes the adverse impacts of these changes on consumers. Web services are platform and language agnostic , and they may be consumed by any client on any platform, as long as that client is capable of exchanging XML. In short, the technologies that Web services are built on enable these remote components to operate in a full-disclosure manner, which removes the mystery of how to call and communicate with them.

ASP.NET provides a special project type and a number of high-level classes for building Web services. Visual Studio .NET (VS .NET) provides excellent productivity benefits for building Web services by encapsulating many of the low-level infrastructure details that are required when building Web services. For example, it will automatically generate the XML-based WSDL file that describes the interface for your Web service. This is enormously beneficial, especially when your Web service interface is evolving in the early stages of development. If you have ever looked at the complexity of a WSDL file, then you will immediately appreciate why you do not want to have to generate these files manually! Finally, VS .NET allows you to avoid having to handle SOAP responses and requests directly. Instead, you can generate a proxy class that handles the SOAP interaction details for you.

Much attention has been given to the fact that XML Web services are platform-independent, meaning that they can respond to requests that originate from any source. Although this is certainly true in concept, it is not always easy to write platform-agnostic Web services. This is mainly because different vendors support a wide range of complex data types (such as the Microsoft ADO.NET DataSet) that may not be equally supported by every platform. In theory, complex data types should be a non-issue, as long as they can serialize to XML and be represented in a SOAP packet. The Web service WSDL file completely documents its interface and the XML namespaces that it references. For example, any Web service built using ASP.NET should reference the XML-MSDATA namespace, which documents complex data types such as the ADO.NET DataSet. Even so, you should be prepared to do some integration work if your project requires you to invoke Web services built on a different platform from the one you are using.

There is a lot of marketing hype surrounding Web services, which we avoid in this chapter in favor of a more pragmatic perspective. In the spirit of this book, we highlight the important aspects of Microsoft-based Web services technology and then look at how you use the technology optimally. Our position on Web services is clear: They are a mind-opening, revolutionary way to bring business logic to the Internet. ASP.NET enables you to build them, and we spend most of this chapter discussing how to build them in the most optimal way.




Performance Tuning and Optimizing ASP. NET Applications
Performance Tuning and Optimizing ASP.NET Applications
ISBN: 1590590724
EAN: 2147483647
Year: 2005
Pages: 91

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