0% found this document useful (0 votes)
66 views12 pages

IT405 Week 09

This document discusses creating web services and handling asynchronous requests. It covers: - The benefits of asynchronous web methods for handling multiple requests without blocking threads. - The rules for creating asynchronous web methods with BeginXXX and EndXXX patterns. - How the ASP.NET AJAX framework uses handlers and modules to process asynchronous web service calls from the browser. - Some scalability challenges for proxy services including slow requests from large data, keeping connections open, DNS resolution delays, and denial of service attacks.

Uploaded by

SaAl-ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views12 pages

IT405 Week 09

This document discusses creating web services and handling asynchronous requests. It covers: - The benefits of asynchronous web methods for handling multiple requests without blocking threads. - The rules for creating asynchronous web methods with BeginXXX and EndXXX patterns. - How the ASP.NET AJAX framework uses handlers and modules to process asynchronous web service calls from the browser. - Some scalability challenges for proxy services including slow requests from large data, keeping connections open, DNS resolution delays, and denial of service attacks.

Uploaded by

SaAl-ismail
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 12

IT405: E-Portals Development

Building a Web 2.0 Portal with ASP.Net 3.5 Al Zabir, Omar (2008)

Chapter 7: Creating Web Services


Objectives
Recognize scalability problems with web servers.
Understand Asynchronous Web Methods.
Recognize a framework for handling web service calls.
Describing scalability challenges of a proxy service.
Web Services
Web service is a technology to communicate one programming
language with another.
For example, java programming language can interact with PHP
and .Net by using web services.
In other words, web service provides a way to achieve
interoperability.
Scalability Problems with Web Services
1. Ajax web sites make frequent calls to web services
Ajax web sites produce more ASP.NET requests than similar
non-Ajax web sites.
2. Incoming and outgoing requests double the load on ASP.NET.
3. ASP.NET has a limited number of worker threads that serve the
requests.
When theres no threads free, ASP.NET cannot execute requests
and they are placed in a waiting queue.
Only when a worker thread becomes free does a request from
the queue gets the chance to execute. This can lead to a non-
responsive website.
Scalability Problems with Web Services
Scalability problems with web servers - too many requests for
ASP.NET to handle.
Asynchronous Web Methods
All web methods on a web service are synchronous on the
server.
The call from the browser via XML HTTP is asynchronous. But
the execution of the web method at the server is
synchronous.
When a request comes until a response is generated from a
web method call, it occupies a thread from the ASP.NET
worker pool.
The thread that is processing the request will be in use until
the method call is done.
Asynchronous Web Methods
To make asynchronous web methods, you need to ensure
the following rules are met:
1. There is a BeginXXX and EndXXX web method where XXX is any string
that represents the name of the method you want to expose.
2. The BeginXXX function returns an IAsyncResult interface and takes
an AsyncCallback and an object as its last two input parameters,
respectively.
3. The EndXXX function takes an IAsyncResult interface as its only
parameter.
4. Both the BeginXXX and EndXXX methods must be flagged with the
WebMethod attribute.
Asynchronous Web Methods
An Asynchronous Web Method
Asynchronous Web Methods
You cannot use asynchronous web method:
1. when you use a business layer to read or write data thats
not asynchronous itself.
2. when you are calling an external web service
synchronously.
3. when you perform database operations using regular
synchronous methods.
4. when theres no wait on some I/O operation such as HTTP
requests, web service calls, remoting, asynchronous
database operations, or asynchronous file operations.
Framework to Handle Web
Service Calls The call from the browser via
XML HTTP is asynchronous

ASMX Web When you make a web service call from the browser via the ASP.NET AJAX
Service Framework, it uses XML HTTP to make a call to a server-side web service.
Source file
Calls to ASMX files are handled by ASP.NETs ASMX handler.
When you add ASP.NET AJAX to your web application, you need to make
some changes in the web.config to remove the default ASMX handler
and add the ASP.NET AJAX Frameworks own ScriptHandler as the
ASMX handler.
You also add a ScriptModule in the HTTP modules pipeline.
ScriptHandler is a regular HTTP handler that finds out which web
service and web method is called by parsing the URL.
Framework for Handling Web Service
Calls
The steps involved in calling a web method:

Confirm its an Ajax web method call.


Find out which .asmx is called.
Find the web service class and method.
Deserialize input parameters into the proper data type.
See the parameters in the method and map each parameter.
Initialize the cache policy.
Invoke the method and pass the parameter values.
Get the return value.
Emit the JSON/XML.
Scalability Challenges
Scalability challenges of a proxy service.
Widgets occupy a lot of data that slows requests.
It is difficult to keep HTTP connections open to frequently
requested busy servers.
DNS resolution is another performance obstacle.
Proxy abuse is an issue.
Denial of service requests.

You might also like