Creating Clients with Visual Studio .NET



Creating Clients with Visual Studio .NET

When using Visual Studio .NET, building clients to Web services is even easier. It's nearly as easy as adding a reference to a regular API in your project. There's a convenient Add Web Reference dialog box (Figure) exactly for that kind of thing. This dialog box behaves much the way that disco.exe and wsdl.exe (in .NET Framework) do combined.

1. The Add Web Reference Dialog Box

graphics/04fig01.gif

This dialog box works similarly to Internet Explorer or any other browser. You type a location, and then the process displays that location in the left-hand window. It also inspects the location to see if it is a DISCO document, a WSDL file, or an HTML page that links to a DISCO document. If it is any of those, then the process runs another process similar to disco.exe on that location.

If during this discovery process, the process finds a WSDL, then it enables the Add Reference button. Pressing this button will run a process similar to wsdl.exe, and add proxy classes to your project, which will then appear under the "Web References" node in Visual Studio .NET's Solution Explorer (Figure). By default, the actual proxy class created isn't displayed in Solution Explorer. To view it, you need to click the "Show All Files" button in Solution Explorer (Figure).

2. Solution Explorer

graphics/04fig02.gif

3. Show All Files

graphics/04fig03.gif