|
Microsoft ASP.NET AJAX the Series Part 5 - Call Web Service
With JavaScript |
|
description |
The
asynchronous communication
layer is the
foundation for very responsive client Web application
presentation.
This article and source code
introduce the Microsoft Ajax asynchronous communication
layer and demonstrates how to use it to call a web service,
from a client, using JavaScript. |
|
source code -> |
AJAXBeta2CallWebServiceFromJavaScript_VB.zip
AJAXBeta2CallWebServiceFromJavaScript_CS.zip |
|
environment |
Visual Studio 2005 |
|
language
|
Visual Basic, C# |
|
tags |
Microsoft AJAX, asynchronous
communication layer, JavaScript, web service |
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.
-
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
|