Visual C#. NET 2003 Unleashed

IN BRIEF

Many of the samples available for consuming web services consist mainly of a simple application that makes a synchronous call to a Hello World web service, and that's the end of the sample. In the real world, however, a programmer needs to be aware of quite a few things in order to provide high-quality web service consumption. One such concern is how to obtain the proper and current definition of the web service and how to integrate that definition into the application. Another concern might be how to deal with asynchronous access to avoid creating an unfriendly user experience, as well as issues such as network detection, reliability, and keeping the application functional when the web service is unavailable or offline.

This chapter will show you how to deal with all of these things and more. Follow along with the code samples, and by the time you reach the end of the chapter you should feel extremely confident in your skills to not only consume a web service, but to consume it properly and with sufficient error handling, reliability, and ease of use.

WHAT YOU NEED

REQUIRED SOFTWARE

.NET Framework SDK v1.1 Visual Studio .NET 2003 with C# installed IIS version 5+

RECOMMENDED HARDWARE SKILLS REQUIRED

PC that meets .NET SDK minimum requirements C# and .NET familiarity Familiarity with ASP.NET

CONSUMING WEB SERVICES AT A GLANCE

Adding Web References

373

  
 

Adding References in Visual Studio .NET

373

Using WSDL.EXE

377

Supporting Dynamic URLs

378

  
 

Storing URLs in app.config

379

Dynamic URLs via UDDI Consumption

382

 

Storing URLs in Isolated Storage

379

  

Consuming Web Services Asynchronously

383

  
 

Multithreaded Service Consumption Sample

384

  

Web Service Client Reliability

385

  
 

Testing for Network Connection

386

Supporting Offline Actions

387

 

Handling Web Service Errors

387

  

Summary

388

  

Further Reading

388

  

    Категории