Web Services: How To Consume Web Services

This application demonstrates how to consume various real-world .NET Web services.

Feature Highlights:

A TabControl provides six different examples of Web service consumption, in increasing order of implementation complexity.

1. Look up sales rank and price information for any book from Amazon and Barnes & Noble by entering an ISBN number.
Web service URL: http://www.perfectxml.net/WebServices/SalesRankNPrice/BookService.asmx

2. View the Dilbert cartoon-of-the-Day from the Daily Dilbert Web service. This example invokes the Web service asynchronously.
Web service URL: http://www.esynaps.com/WebServices/DailyDiblert.asmx (Notice there is a spelling error in this Url. It is correct as listed above. The Web service authors misspelled it.)

Status messages and error messages within structure error handling are used to inform the user during the data retrieval process.

Requirements:

Requires Microsoft Visual Studio.NET Professional or Higher and Windows 2000 or Windows XP.

This application requires the Microsoft Universal Description Discovery and Integration (UDDI) SDK 1.76, which can be downloaded from: http://msdn.microsoft.com/library/default.asp?url=/nhp/Default.asp?contentid=28001204

1. These real-world Web services were found on http://www.xmethods.com/.

2. To consume a Web service you need to add a Web Reference to the Visual Studio .NET project. In the Add Web Reference type in the address of the Web service (e.g., see those listed above) and click Add Reference. This will cause Visual Studio .NET to query the WSDL document and create a proxy class as a local API for you to program against.

3. Often the name given to the Web service proxy class namespace is undesirable. You can easily change this by expanding Web References in the Solution Explorer and right-clicking, Web Reference node you wish to change, and then selecting Rename.

4. You can use UDDI to search for available Web services from within Visual Studio .NET. Click the "XML Web Services" link on the Start page. If you do not see the Start page, from the Visual Studio .NET menu bar select Help | Show Start Page.

See Also

Accessing XML Web Services  Managing Project Web References