Web Service Description Language tool (wsdl.exe)
The Web Service Description Language tool generates code for XML Web Services and XML Web Services clients from the WSDL protocol file, XSD architecture, and. discomap discovery documents.
wsdl [options] {URL | path}
Parameters
Description
URL
Point to the URL of the WSDL protocol file (. WSDL), XSD Schema file (. XSD), or discovery document (. Disco. Note that you cannot specify the URL as A. discomap document.
Path
Path of the local WSDL protocol file (. WSDL), XSD Schema file (. XSD), or discovery document (. Disco or. discomap.
Option
Description
/Appsettingurlkey: Key
Or
/Urlkey: Key
Specifies the configuration key used to read the default value of the URL attribute when code is generated. Use/ParametersThis value is<AppSettingUrlKey>Element and contains a string.
/Appsettingbaseurl: Baseurl
Or
/Baseurl: Baseurl
Specify the base URL used to calculate the URL fragment. This tool usesBaseurlThe parameter is converted to the URL in the WSDL document to calculate the URL segment. You must use this option to specify/Appsettingurlkey. Use/ParametersThis value is<AppSettingBaseUrl>Element and contains a string.
/D[Omain]:Domain
The domain name used to connect to the server that requires authentication. This value is<Domain>Element and contains a string.
/L[Anguage]:Language
Specifies the language used for the generated proxy class. You can specifyCS(C #; default ),VB(Visual Basic ),JS(Jscript) orVJS(Visual J #) as the language parameter. You can also specify the fully qualified name of the class that implements the System. CodeDom. Compiler. CodeDomProvider class. This value is<Language>Element and contains a string.
/N[Amespace]:Namespace
Specify the namespace of the generated proxy or template. The default namespace is a global namespace. This value is<Namespace>Element and contains a string. This element must be in the parameter file.
/Nologo
Undisplay Microsoft startup title. This value is<Nologo>Element and containTrueOrFalse.
/Order
Generates an explicit sequence identifier on a particle member.
/O[Ut]:Filename or directoryname
Specifies the file (or directory) used to save the generated proxy code ). You can also specify the directory in which the file is to be created. This tool exports the default file name from the XML Web services Name. This tool saves the generated data set to different files. This value is<Out>Element and contains a string.
/Parameters
READ command line options from the specified xml file. With this option, many options can be passed to the Wsdl.exe tool at one time. The abbreviation is "/par :". Optional elements are included in<WsdlParametersXmlns = "http://microsoft.com/webReference">Element. For more information, see the remarks section.
/Parsableerrors
Displays errors in an error report format similar to that used by the Language compiler. This value is<Parsableerrors>Element, andTrueOrFalse.
/P[Assword]:Password
Specifies the password used to connect to the server that requires authentication. This value is<Password>Element and contains a string.
/Protocol: Protocol
Specify the protocol to be implemented. You can specifySOAP(Default ),HttpGet,HttpPostOr the custom protocol specified in the configuration file. This value is<Protocol>Element and contains a string.
/Proxy: URL
Specifies the URL of the proxy server used for HTTP requests. By default, system proxy settings are used. This value is<Proxy>Element and contains a string.
/Proxydomain: Domain
Or
/Pd: Domain
Specifies the domain used to connect to the proxy server that requires authentication. This value is<Proxydomain>Element and contains a string.
/Proxypassword: Password
Or
/Pp: Password
Specifies the password used to connect to the proxy server that requires authentication. This value is<Proxypassword>Element and contains a string.
/Proxyusername: Username
Or
/Pu: Username
Specifies the username used to connect to the proxy server that requires authentication. This value is<Proxyusername>Element and contains a string.
/Server
Generate the abstract class of XML Web Services according to the agreement. The client proxy class is generated by default. Use/ParametersThis value is<Style>Element and contains "server ".
/ServerInterface
Generate interfaces for servers of ASP. NET web services. Generates an interface for each binding in the WSDL document. WSDL implements the WSDL protocol separately (the class implementing the interface should not include one of the following attributes in the class method: Modify the Web service attribute or serialization attribute of the WSDL protocol ). The abbreviation is "/Si ". This value is<Style>It also contains "servicerinterface ".
/Sharetypes
Enable the type sharing function. This function uses a type definition to create a code file for the same type shared by different services (the namespace, name, and connection signature must be the same ). Reference a service with "http: //" URL as a command line parameter, or create a discomap document for a local file. This value is<Sharetypes>Element, andTrueOrFalse.
/U[Sername]:Username
Specifies the username used to connect to the server that requires authentication. This value is<Username>Element and contains a string.
/?
Displays the command syntax and options of the tool.
Remarks
The. WSDL file is an XML document written using the XML syntax called Web Service Description Language (WSDL. This file defines the behavior of XML Web Services and instructs the client how to interact with the service.
You can use the web service discovery tool (disco.exe) to obtain the XML Web Services Discovery document. The. discomap,. Disco,. WSDL, And. XSD files generated by this tool can be used as input for wsdl.exe.
When you use Wsdl.exe to create a proxy class, a source file is created in the specified programming language. In the process of generating source code for the proxy class, the tool determines the optimal type of objects used in the service description. In some cases, the tool converts these objects into a type using the minimum public denominator method. Therefore, the generation type in the proxy class may not be the type that the developer wants or expects. For example, when Wsdl.exe encountersArrayListType, it will createObject Array. To ensure that the object type conversion is correct, open the file containing the generated proxy class and change all incorrect object types to the desired object type.
/ParametersThe XML file format accepted by the options is external<WsdlParameters xmlns = "http://microsoft.com/webReference/">A series of elements in the element. If the command prompt value is specified and/ParametersFile, use the value specified at the command prompt.<WsdlParameters xmlns = "http://microsoft.com/webReference/">The element must contain<Nologo>Element,<Parsableerrors>Element and<Sharetypes>Element.
Multiple options<WebReferenceOptions>Element (must contain<Verbose>Element.<WebReferenceOptions>Other sub-elements are:
<Style>. Includes "client", "server", or "serverInterface ".
<SchemaImporterExtension>. Contains any number<Type>Element.
<CodeGenerationOptions>. It can be a set of spaces separated by the following strings.
"Properties"
"NewAsync"
"OldAsync"
"Order"
"EnableDataBinding"
See examples to get the/parameters Option.
Example
The following command creates the XML Web services client proxy class in C.
Copy code
wsdl http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
The following command uses the C # language to create a client proxy class for XML Web services located at the specified URL. This tool saves the client proxy class inMyProxyClass. csFile.
Copy code
wsdl /out:myProxyClass.cs http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
The following command uses Microsoft Visual Basic to create a client proxy class for XML Web services at the specified URL. This tool saves the client proxy class inMyProxyClass. vbFile.
Copy code
wsdl /language:VB /out:myProxyClass.vb http://hostServer/WebserviceRoot/WebServiceName.asmx?WSDL
Copy code
<wsdlParameters xmlns="http://microsoft.com/webReference/"> <nologo>true</nologo> <parsableerrors>true</parsableerrors> <sharetypes>true</sharetypes></wsdlParameters>
The WSDL document has passed<Documents>Add element/ParametersIn the WSDL file, the following code example is shown. In<Documents>Any number<Document>Element.
Copy code
<wsdlParameters xmlns="http://microsoft.com/webReference/"> <nologo>true</nologo> <parsableerrors>true</parsableerrors> <sharetypes>true</sharetypes> <documents> <document>http://www.contoso.com/service.asmx?WSDL</document> </documents></wsdlParameters>
The following/ParametersWSDL file demonstration<WebReferenceOptions>Element<CodeGenerationOptions>And<Style>Element usage. In this example, the file enables a New Data Binding style in the proxy code, and specifies a schema import program extension, specifying that the output does not show details, and specifying Wsdl.exe to create a client proxy.
Copy code
<wsdlParameters xmlns="http://microsoft.com/webReference/"> <nologo>true</nologo> <parsableerrors>true</parsableerrors> <sharetypes>true</sharetypes> <documents> <document>http://www.contoso.com/service.asmx?WSDL</document> </documents> <webReferenceOptions> <verbose>false</verbose> <codeGenerationOptions>properties newAsync enableDataBinding</codeGenerationOptions> <schemaImporterExtension> <type>MyNamespace.MyCustomImporterExtension,ExtensionLibrary</type> </schemaImporterExtensions> <style>client</style> </webReferenceOptions></wsdlParameters>
See
Reference
. NET Framework tool
Web service discovery tool (Disco.exe)
SDK Command Prompt
Other resources
Create an XML Web Service Proxy
XML Web Service Description
XML Web Service Overview