Writing the Client

To create a client that uses your new web service, create a new (normal) ASP.NET web site called StockPriceClient, as shown in Figure 14-6.

Your client will need knowledge of your web service. The easiest way to provide that knowledge is to create a web reference. Right-click on your project and choose Add Web Reference, as shown in Figure 14-7.

WSDL document

Figure 14-5. WSDL document

Creating client web site

Figure 14-6. Creating client web site

The Add Web Reference dialog will open. If you have created the web service on the same machine as the client, click on "web services on the local machine," as shown in Figure 14-8.

Warning

If you have been using file-based web applications, you'll need to create a virtual directory in IIS to point to the web service, for this web reference to work.

Add Web Reference

Figure 14-7. Add Web Reference

Choosing local web service

Figure 14-8. Choosing local web service

Once you click on Service, the Add Web Reference dialog will locate the service (and bring up the test page). Give your service a reference name (a name by which you can refer to it in your code) and click Add Reference, as shown in Figure 14-9.

Figure 14-9. Name ...

Get Programming Visual Basic 2005 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.