Andrea Azzola

Technology, Personal Development and Financial Independence

Import Web service References in .NET

Posted on [Permalink]

WARNING: the content of this post has been flagged as "out of date" by the author

You may need to consume Web services from  client applications. Visual Studio provides tools for generating proxy classes, which in this case, however, may be ineffective.

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.


"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 we're saying:

  • The path of the WSDL
  • "/n" - the target namespace of the proxy class
  • "/o" - the path of output files
  • "/l" - the target language

A complete list of options is available at this Url:
If you plan on generation more files related to classes in the same namespace, is useful to remember that some objects are implicitly declared many times, these duplicates must be removed manually.

Related articles:

Categories: Web services