mike mcintyre's

.N e t J o u r n a l

This blog hosted by:
http://blogs.vbcity.com      
  Home :: Syndication  :: Login

AprMay 2008Jun
SMTWTFS
27282930123
45678910
11121314151617
18192021222324
25262728293031
1234567

Archives

Topics

Source Code

Source Code:  Microsoft ASP.NET AJAX the Series Part 5 - Call Web Service With JavaScript

This is the fifth in a series of blog posts about Microsoft ASP.NET AJAX, a new web development technology from Microsoft.

Click these links to view previous posts in this series: Post 1, Post 2, Post 3, and Post 4

This post introduces the Microsoft Ajax asynchronous communication layer and demonstrates how to use it to call a web service, from a client, using JavaScript.

Asynchronous Communication Layer

The asynchronous communication layer is the foundation for very responsive client Web application presentation.

The layer enables more separation between the business and data tiers on the server and the presentation tier on the client. It makes it easier to do more processing client side. In this context, the browser has full control of the presentation tier and provides a rich and responsive user interface, while the server performs the business and data tier tasks.

The layer exposes functionality for browser asynchronous behavior provided by the XMLHTTP object as a set of APIs that JavaScript functions can use from any browser to call Web service methods on the server. The XMLHTTP object enables the browser to send asynchronous HTTP requests and return data that can be processed in client script.

What can you do through the asynchronous communication layer?

  • Asynchronous postbacks and partial-page rendering

  • Invoke methods in Web services implemented as .asmx files

  • Invoke specifically enabled ASP.NET page methods

  • Supports a variety of serialization formats for passing data between the browser and the server

  • Optimize Web service interactions by pre-loading and caching JavaScript proxies used to communicate with the Web services on a server

About the Source Code

The source code includes a Web service whose proxy class is used by the browser and an ASP.NET Web page containing client script that calls a page method and a web service. Here is a screen shot of the web page:

The source code included with this post (see download link above) demonstrates how to call a web service with JavaScript. Additional comments about the process are included in the example page and source code.

The source code was created with ASP.NET AJAX 1.0 Beta 2 which is available at -> The Official Microsoft ASP.NET AJAX Website

The next post in this series will explore the Microsoft Ajax Page Manager object.

For more information and FREE Microsoft ASP.NET Ajax installers visit -> The Official Microsoft ASP.NET AJAX Website

mike mcintyre    http://www.getdotnetcode.com

 

posted on Tuesday, December 05, 2006 8:15 PM