developer.com
Search EarthWeb
CodeGuru | Gamelan | Jars | Wireless | Discussions
Navigate developer.com
Architecture & Design  
Database  
Java
Languages & Tools
Microsoft & .NET
Open Source  
Project Management  
Security  
Techniques  
Voice  
Web Services  
Wireless/Mobile
XML  
Technology Jobs  

   Developer.com Webcasts:
  The Impact of Coding Standards and Code Reviews

  Project Management for the Developer

  Defining Your Own Software Development Methodology

  more Webcasts...




See the Winners!


Developer Jobs

Be a Commerce Partner
Prepaid Phone Card
Compare Prices
Televisions
Imprinted Promotions
Memory
Corporate Awards
Laptops
PDA Phones & Cases
Hurricane Shutters
Holiday Gift Ideas
Promotional Gifts
Laptop Batteries
Find Software
Data Center Solutions

 


Web Devs:
Moonlight as a Game Developer and Win Cool Prizes by Accepting the RIA Run Challenge

Now, your mission--should you choose to accept: Take your shot at gaming stardom if you think you might have what it takes to build a cool RIA game and you could win an Xbox 360 or other fabulous prizes. Hurry! You only have until May 15, 2008 to enter. »

 
Article:
Leveraging Your Flash Development with Silverlight

You're not giving up Flash any time soon (and we don't blame you.) But if you could get your Flash application working in Silverlight, why wouldn't you? We show you the tools and techniques required to have your rockin' Flash application rolled for Silverlight. Learn more here. »

 
Article:
What Does it Take to Build the Best RIA?

With the proliferation of Rich Interactive Application (RIA) platform choices out there, you no longer have to take a one-size-fits-all approach to developing your next RIA application. Knowing the strengths (and weaknesses) of each platform can help you to decide the best RIA for your next application. »

 
Related Article -
Working With Asynchronous .NET Web Service Clients
Developer News -
SaaS Tool Offers Custom Database Development    May 9, 2008
Microsoft’s Automated Agent: Can We Talk?    May 7, 2008
Borland Finally Sells CodeGear    May 7, 2008
Red Hat Heads For The JON 2.0    May 7, 2008
Free Tech Newsletter -

Best Practices for Developing a Web Site: Checklists, Tips, Strategies & More. Download Exclusive eBook Now.

Asynchronous Web Services Invocation in .NET Framework 2.0
By Thiru Thangarathinam

Go to page: 1  2  3  Next  

Synchronous communication between .NET applications and Web services makes the user wait while each Web service processes requests and returns results. This can have a severe impact on the performance of the .NET application. Typically, a distributed .NET application requires information from multiple Web services. If the application performs the entire process of invoking the Web services synchronously, a client must wait not only until every Web service provider is contacted, but also through any connection or service delays.

Asynchronous Web services invocation solves this performance issue and enhances the end user experience by increasing server efficiency. With the introduction of .NET Framework 2.0, Microsoft has greatly enhanced the support for asynchronous Web services invocation by introducing a new event-based programming model. This article examines this new feature and demonstrates how to take advantage of it to create feature-rich and effective .NET applications. It also shows how to perform data binding directly with the results the Web service returns.

Event-Based Asynchronous Programming

Previous versions of the .NET Framework used the BeginInvoke/EndInvoke methods to invoke a Web service asynchronously. Version 2.0 adds a new way to asynchronously invoke Web services: an event-based asynchronous programming model. It enables this new event programming model through the creation of properties and methods on the client proxy class.

To follow the demonstration for implementing this model, you must first create a simple Web service that then can be invoked asynchronously from the client application. The following section walks you through the process.

Create a Simple Web Service

Open Visual Studio 2005 and select New->Web Site from the File menu. In the New Web Site dialog box, select ASP.NET Web service from the list of project templates, and specify the name of the Web service as AsyncWebServices.

Once you have created the Web site, add a new Web service file named HelloService.asmx to the project. If you open the file and view the code, you will find a method named HelloWorld already placed in the code-behind file of the Web service. For the purposes of this example, just utilize this default sample method. Here is the code from the code-behind file of the HelloService:

using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1,
                   EmitConformanceClaims = true)]
public class HelloService : System.Web.Services.WebService 
{
    [WebMethod]
    public string HelloWorld()
    {
        return "Hello World";
    }
}
Note: When you create a Web service through Visual Studio 2005, the code-behind file for the Web service is automatically placed in the App_Code directory, which is a new directory in ASP.NET 2.0 that acts as a container for all the reusable classes in an ASP.NET Web application.

Now that you've created the Web service, if you right click on it and select View in Browser, you will see the screen shown in Figure 1.



Click here for a larger image.

Figure 1. View Newly Created Web Service in Browser

If you click on the HelloWorld method, you will see the screen shown in Figure 2.



Click here for a larger image.

Figure 2. View HelloWorld Method in Browser

Clicking on the Invoke button in the Figure 2 results in the screen shown in Figure 3.



Click here for a larger image.

Figure 3. Invocation of HelloWorld Method

Figure 3 shows the output produced by the HelloWorld method. Now that you have implemented and tested the Web service, you can move on to the client application that will consume the Web service.

Go to page: 1  2  3  Next  


Tools:
Add www.developer.com to your favorites
Add www.developer.com to your browser search box
IE 7 | Firefox 2.0 | Firefox 1.5.x
Receive news via our XML/RSS feed


.NET Archives

Work With InterSystems. Not Separate Systems. Rapidly develop and deploy connectable applications.
Generate Complete .NET Web Apps in Minutes . Download Iron Speed Designer today.
Whitepaper: XML Processing in Applications--Take the Next Step
Best Practices for Developing a Web Site. Checklists, Tips & Strategies. Download Exclusive eBook Now.
Five Trends for Application Development & Program Management. Download Complimentary Report Now.



JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES