As described in Chapter 15 and shown schematically in Figure 15-1, a web service is consumed by a client application by use of a proxy. A proxy is a substitute, or local stand-in, for the web service. Once the proxy is created and registered with the consuming application, then method calls can be made against the web service. In actuality, those method calls will be made against the local proxy. It will seem to the consuming application that the web service is local to the application.
There are two ways to generate the proxy. The first way, described in the next section, is to generate the source code for the proxy class manually and compile that into the proxy DLL. The advantages to this method are:
You do not need to use Visual Studio .NET.
The command-line approach offers more flexibility and features over Visual Studio .NET.
The alternative method is to allow Visual Studio .NET to create the proxy and register it with the consuming application in a single step. The advantage to this method is that it is much less work. Using Visual Studio .NET will be demonstrated shortly.
To create the proxy, use another command-line utility called wsdl.exe . This utility takes a WSDL file as input. The WSDL file can either be stored locally, having been previously created using the disco command-line utility, or it can be generated on the fly from the web service file itself. The following two command lines will yield the same ...