Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Building Microsoft ASP.NET Applications for Mobile Devices, Second Edition [Electronic resources] - نسخه متنی

Andy Wigley; Peter Roxburgh

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
تنظیمات قلم


اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
افزودن یادداشت جدید

Introduction to XML Web Services

XML Web services differ immensely from earlier distributed component technologies, such as CORBA or DCOM. For one thing, they're platform independent and language independent; programs written in any language (not just the Microsoft .NET Framework languages) and running on any platform can consume them. For another, they're based on existing, open protocols: XML Web services run over protocols, such as HTTP; use the lightweight, XML-based Simple Object Access Protocol (SOAP) to communicate; and return data defined using XML Schema Definition (XSD) data types packaged into XML messages. Because they are constructed using these established standards, XML Web services can navigate today's Internet firewall landscape, unlike other remote access methods. Firewalls that allow the passage of regular Web traffic over HTTP also allow the passage of data passing to and from an XML Web service. The use of XML as a means both to describe the service (to describe to client software how to access the service) and to communicate data between a client and an XML Web service makes this powerful component architecture truly cross-platform.

Using XML Web Services in Web Applications

XML Web services provide data or services that can be accessed by client programs situated elsewhere on the Web. A good example of an XML Web service is the Microsoft MapPoint .NET Web service (see This service is a great way of building location-based mobile Web applications. For example, you can build an application using ASP.NET mobile controls designed to give driving directions. Your application would accept input from users giving their starting location and their destination, and in the code of your application you call the MapPoint .NET Web service, passing it the two locations. The Web service returns the driving directions to your Web application, which displays the directions using standard ASP.NET mobile controls.

Messages that your application sends to an XML Web service and the response that comes back from the Web service must be written in XML using the SOAP protocol. Fortunately, unless you are a developer who is deeply involved in the intricacies of XML Web services, you do not need to know much about how SOAP works. Using the .NET Framework tools or Microsoft Visual Studio .NET, you can add to your Microsoft ASP.NET project automatically generated code that handles formatting of messages and communication with the XML Web service and transparently parses the XML response so that calling an XML Web service is no more complicated than calling a method of a local object.

XML Web services are easy to write, especially because doing so requires skills that you probably already possess. XML Web services written using the .NET Framework are also easy to deploy and consume. Furthermore, the supporting files an XML Web service requires are easy to produce using the powerful command-line tools provided in the .NET Framework SDK or through Microsoft Visual Studio .NET.

Although simple to write, deploy, and consume, XML Web services allow you to work with complex data types, such as classes, enumerations, and structures. You can even pass Microsoft ADO.NET DataSet objects back and forth. XML Web services written for ASP.NET have access to the Session and Application objects like any other ASP.NET Web application, which you should now be familiar with. Thus, you can maintain both application and session state for your XML Web service.

Managing Session and Application State

A surprising yet very useful feature of XML Web services built with ASP.NET is their state management capability. Like any other ASP.NET application, an XML Web service provides access to both the Session object and the Application object, which you learned about in Chapter 12. You use the Session object and the Application object within an XML Web service the same way you use them in a mobile Web Forms page. You should refer to Chapter 12 for details of how to make use of these objects.

/ 145