Web Services Description Language Tool (Wsdl.exe)
The Web Services Description Language tool generates code for XML Web services and XML Web service clients from WSDL contract files, XSD schemas, and .discomap discovery documents.
wsdl [options] {URL | path}
Argument | Description |
---|---|
URL | The URL to a WSDL contract file (.wsdl), XSD schema file (.xsd), or discovery document (.disco). Note that you cannot specify a URL to a .discomap discovery document. |
path | The path to a local WSDL contract file (.wsdl), XSD schema file (.xsd), or discovery document (.disco or .discomap). |
Option | Description |
---|---|
/appsettingurlkey:key
or /urlkey:key |
Specifies the configuration key to use in order to read the default value for the URL property when generating code. |
/appsettingbaseurl:baseurl
or /baseurl:baseurl |
Specifies the base URL to use when calculating the URL fragment. The tool calculates the URL fragment by converting the relative URL from the baseurl argument to the URL in the WSDL document. You must specify the /appsettingurlkey option with this option. |
/d[omain]:domain | Specifies the domain name to use when connecting to a server that requires authentication. |
/l[anguage]:language | Specifies the language to use for the generated proxy class. You can specify CS (C#; default), VB (Visual Basic), JS (JScript) or VJS (Visual J#) as the language argument. You can also specify the fully qualified name of a class that implements the System.CodeDom.Compiler.CodeDomProvider Class. |
/n[amespace]:namespace | Specifies the namespace for the generated proxy or template. The default namespace is the global namespace. |
/nologo | Suppresses the Microsoft startup banner display. |
/o[ut]:filename | Specifies the file in which to save the generated proxy code. The tool derives the default file name from the XML Web service name. The tool saves generated datasets in different files. |
/parsableerrors | Displays errors in a format similar to the error reporting format used by language compilers. |
/p[assword]:password | Specifies the password to use when connecting to a server that requires authentication. |
/protocol:protocol | Specifies the protocol to implement. You can specify SOAP (default), HttpGet, HttpPost, or a custom protocol specified in the configuration file. |
/proxy:URL | Specifies the URL of the proxy server to use for HTTP requests. The default is to use the system proxy setting. |
/proxydomain:domain
or /pd:domain |
Specifies the domain to use when connecting to a proxy server that requires authentication. |
/proxypassword:password
or /pp:password |
Specifies the password to use when connecting to a proxy server that requires authentication. |
/proxyusername:username
or /pu:username |
Specifies the user name to use when connecting to a proxy server that requires authentication. |
/server | Generates an abstract class for an XML Web service based on the contracts. The default is to generate client proxy classes. |
/u[sername]:username | Specifies the user name to use when connecting to a server that requires authentication. |
/? | Displays command syntax and options for the tool. |
Remarks
A .wsdl file is an XML document written in an XML grammar called Web Services Description Language (WSDL). This file defines how an XML Web service behaves and instructs clients as to how to interact with the service.
You can obtain discovery documents for an XML Web service using the Web Services Discovery Tool (Disco.exe). The .discomap, .disco, .wsdl, and .xsd files produced by this tool can be used as input to Wsdl.exe.
When you use Wsdl.exe to create a proxy class, a single source file is created in the programming language that you specify. In the process of generating the source code for the proxy class, the tool determines the best type to use for objects specified in the service description. In some cases the tool uses a least-common-denominator approach for casting objects to a type. As a result, the generated type in the proxy class might not be what the developer wants or expects. For example, when Wsdl.exe encounters an ArrayList type in a service description, it creates an Object Array in the generated proxy class. To ensure correct object type casts, open the file containing the generated proxy class and change any incorrect object types to the expected object type.
Examples
The following command creates a .wsdl file for the XML Web service located at the specified URL and creates a client proxy class in the C# language for the XML Web service.
wsdl http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
The following command creates a client proxy class in the C# language for an XML Web service located at the specified URL. The tool saves the client proxy class in the file myProxyClass.cs
.
wsdl /out:myProxyClass.cs http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
The following command creates a client proxy class in the Microsoft Visual Basic language for an XML Web service located at the specified URL. The tool saves the client proxy class in the file myProxyClass.vb
.
wsdl /language:VB /out:myProxyClass.vb http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
See Also
.NET Framework Tools | Web Services Discovery Tool (Disco.exe) | Creating an XML Web Service Proxy | XML Web Service Description | XML Web Services Overview