Consumption of Web Services is one of the strong points of Visual Studio. A typical Web Service consumer will be a command application, a desktop application, or a service. Other applications may require some additional security configuration in the code, so for the sake of simplicity, we'll focus on a standard desktop application calling Web Services.
Here, in just few lines of code, we'll be able to recreate the same functionality as in InfoPath and WebService Studio combined. As shown in Figure 26-10, we will use two Web Services to retrieve lists from the server, and then, once we obtain the GUID of each list, we will be able to retrieve data from the list.
First, create a new Windows Application Project.
Next, add references to the Web Services:
Right-click the root node of the project in Solutions Explorer.
Select Add Web Reference.
Figure 26-9. Add Users in Policy for Web Application
In the Add Web Reference dialog box (Figure 26-11), you have to navigate to the Web Service you will utilize. If working with a local server, you can select the "Web Services on the Local Machine" link and navigate to the Lists Web Service; if working with another server, enter the URL of the Web Service. If you intend on binding to a specific web site within your portal, enter its full path, such as:
Next, when the ...