Note (2025): This post refers to .NET Framework 2.0 era tools such as wsdl.exe. Modern .NET projects generally use
Connected Services
in Visual Studio ordotnet svcutil
. The example is preserved for historical reference.
You may need to consume Web services from client applications. Visual Studio provides tools for generating proxy classes, which in some cases may be insufficient. In those cases, the wsdl.exe
tool is an alternative.
The wsdl.exe tool
You can use the command prompt tool wsdl.exe, included within the .NET Framework 2.0 SDK. This tool accepts the path to a WSDL file and generates the proxy class automatically.
Example
"C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin\wsdl.exe" ^
"C:\ServiceTest.wsdl" /n:MyNameSpace.MyServices /o:"C:\ServiceTest.cs" /l:CS
In this example:
- The path of the WSDL is specified
/n
sets the target namespace of the proxy class/o
specifies the output file path/l
sets the target language (here: C#)
A complete list of options is available in the official MSDN documentation.
⚠️ If you generate multiple files related to classes in the same namespace, remember that some objects may be declared multiple times; these duplicates must be removed manually.
Related articles
- Testing a Web service with a proxy class{:target="_blank" rel=“noopener”}