C# 有关SOAP的工具选择问题

C# 对于SOAP来说 有1.2 工具和1.3工具

 

1.2 的SOAP工具叫做 wsdl.exe

1.3的SOAP工具叫做 svcutil.exe

...\Microsoft SDKs\Windows\v6.0A\bin

下面有这两个工具

很实用。

wsdl.exe -
    Utility to generate code for xml web service clients and xml web services
    using ASP.NET from WSDL contract files, XSD schemas and .discomap
    discovery documents. This tool can be used in conjunction with disco.exe.

wsdl.exe <options> <url or path> <url or path> ...

     - OPTIONS -

<url or path> -
    A url or path to a WSDL contract, an XSD schema or .discomap document.

/nologo
    Suppresses the banner.

/language:<language>
    The language to use for the generated proxy class.  Choose from 'CS',
    'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified name for a class
    implementing System.CodeDom.Compiler.CodeDomProvider.  The default
    language is 'CS' (CSharp).  Short form is '/l:'.

/sharetypes
    Turns on type sharing feature. This feature creates one code file with
    a single type definition for identical types shared between different
    services (namespace, name and wire signature must be identical).
    Reference the services with http:// URLs as command-line parameters
    or create a discomap document for local files.

/verbose
    Displays extra information when the /sharetypes switch is specified.
    Short form is '/v'.

/fields
    Generate fields instead of properties. Short form is '/f'.

/order
    Generate explicit order identifiers on particle members.

/enableDataBinding
    Implement INotifyPropertyChanged interface on all generated types
    to enable data binding. Short form is '/edb'.

/namespace:<namespace>
    The namespace for the generated proxy or template.  The default namespace
    is the global namespace. Short form is '/n:'.

/out:<fileName|directoryPath>
    The filename or directory path for the generated proxy code. The default
    filename is derived from the service name. Short form is '/o:'.

/protocol:<protocol>
    Override the default protocol to implement.  Choose from 'SOAP',
    'SOAP12', 'HttpGet', 'HttpPost'.

/username:<username>
/password:<password>
/domain:<domain>
    The credentials to use when connecting to a server that
    requires authentication. Short forms are '/u:', '/p:' and '/d:'.

/proxy:<url>
    The url of the proxy server to use for http requests.
    The default is to use the system proxy setting.

/proxyusername:<username>
/proxypassword:<password>
/proxydomain:<domain>
    The credentials to use when the connecting to a proxy server that
    requires authentication. Short forms are '/pu:', '/pp:' and '/pd:'.

/appsettingurlkey:<key>
    The configuration key to use in the code generation to read the default
    value for the Url property. The default is to not read from the config
    file. Short form is '/urlkey:'.

/appsettingbaseurl:<baseurl>
    The base url to use when calculating the url fragment. The
    appsettingurlkey option must also be specified. The url fragment is
    the result of calculating the relative url from the appsettingbaseurl
    to the url in the WSDL document. Short form is '/baseurl:'.

/parsableerrors
    Print errors in a format similar to those reported by compilers.

     - ADVANCED -

/server
    Server switch has been deprecated. Please use /serverInterface instead.
    Generate an abstract class for an xml web service implementation using
    ASP.NET based on the contracts. The default is to generate client proxy
    classes.

/serverInterface
    Generates interfaces for server-side implementation of an ASP.Net
    Web Service. An interface is generated for each binding in the wsdl
    document(s). The wsdl alone implements the wsdl contract (classes
    that implement the interface should not include either of the following
    on the class methods: Web Service attributes or Serialization
    attributes that change the wsdl contract). Short form is '/si'.

/parameters:<file>
    Read command-line options from the specified xml file. This allows you
    to specify options not available from command line such as choosing
    which type of asynchronous programming model is generated. For details,
    please see the tool documentation. Short form is '/par:'.

 

 

Syntax: svcutil.exe /validate /serviceName:<serviceConfigName>  <assemblyPath>*

 <assemblyPath> - The path to an assembly containing service types to be validated. The assembly must have an associated config file to
                  provide service configuration. Standard command-line wildcards can be used to provide multiple assemblies.

Options:

 /validate                        - Validate a service implementation. To validate a service, you must use the /serviceName option to
                                    indicate the service you would like to validate. If this option is used, an executable assembly with an
                                    associated config file must be passed as input. (Short Form: /v)
 /serviceName:<serviceConfigName> - The config name of a service to validate. To validate a service this option must be provided. Svcutil
                                    will search through the associated config files of all input assemblies for the service configuration.
                                    If the associated configuration file contain any extension types, the assemblies containing these types
                                    must either be in the GAC or explicitly provided using the /r option.
 /reference:<file path>           - Add the specified assembly to the set of assemblies used for resolving type references. If you are
                                    exporting or validating a service that uses 3rd-party extensions (Behaviors, Bindings and
                                    BindingElements) registered in config use this option to locate extension assemblies that are not in the
                                    GAC.  (Short Form: /r)
 /dataContractOnly                - Operate on Data Contract types only. Service Contracts will not be processed. (Short Form: /dconly)
 /excludeType:<type>              - The fully-qualified or assembly-qualified name of a service type to exclude from validation. (Short
                                    Form: /et)



                                   -= METADATA DOWNLOAD =-

Description: svcutil.exe can be used to download metadata from running services and save the metadata to local files. To download metadata,
    you must explicitly specify the /t:metadata option. Otherwise, client code will be generated. For http and https URL schemes svcutil.exe
    will try to retrieve metadata using WS-Metadata Exchange and DISCO. For all other URL schemes svcutil.exe will only try WS-Metadata
    Exchange. By default, svcutil.exe uses the bindings defined in the System.ServiceModel.Description.MetadataExchangeBindings class. To
    configure the binding used for WS-Metadata Exchange you must define a client endpoint in config that uses the IMetadataExchange
    contract. This can be defined either in svcutil.exe's config file or in another config file specified using the /svcutilConfig option.

Syntax: svcutil.exe /t:metadata  <url>* | <epr>

 <url> - The URL to a service endpoint that provides metadata or an URL that points to a metadata document hosted online.
 <epr> - The path to an XML file that contains a WS-Addressing EndpointReference for a service endpoint that supports WS-Metadata Exchange.



                             -= XMLSERIALIZER TYPE GENERATION =-

Description: svcutil.exe can pre-generate C# serialization code that is required for types that can be serialized using the XmlSerializer.
    svcutil.exe will only generate code for types used by Service Contracts found in the input assemblies.

Syntax: svcutil.exe /t:xmlSerializer  <assemblyPath>*

 <assemblyPath> - The path to an assembly containing Service Contract types. Serialization types will be generated for all Xml Serializable
                  types in each contract

Options:

 /reference:<file path> - Add the specified assembly to the set of assemblies used for resolving type references. (Short Form: /r)
 /excludeType:<type>    - Fully-qualified or assembly-qualified type name to exclude from export or validation. This option can be used when
                          exporting metadata for a service or a set of service contracts to exclude types from being exported. This option
                          cannot be used with the /dataContractOnly option. (Short Form: /et)
 /out:<file>            - Filename for the generated code. This option will be ignored when multiple assemblies are passed as input to the
                          tool. Default: derived from the assembly name. (Short Form: /o)



                                       -= EXAMPLES =-

 svcutil http://service/metadataEndpoint
    - Generate client code from a running service or online metadata documents.

 svcutil /dconly http://service/metadataEndpoint
    - Generate Data Contract types from a running service or online metadata documents.

 svcutil *.wsdl *.xsd /language:C#
    - Generate client code from local metadata documents.

 svcutil /dconly *.xsd /language:VB
    - Generate Data Contract types in VisualBasic from local schema documents.

 svcutil /t:metadata http://service/metadataEndpoint
    - Download metadata documents from running services

 svcutil myAssembly.dll
    - Generate metadata documents for Service Contracts and associated types in an assembly

 svcutil myServiceHost.exe /serviceName:myServiceName
    - Generate metadata documents for a service, and all associated Service Contracts and data types in an assembly

 svcutil myServiceHost.exe /dconly
    - Generate metadata documents for data types in an assembly

 svcutil /validate /serviceName:myServiceName myServiceHost.exe
    - Verify service hosting

 svcutil /t:xmlserializer myContractLibrary.exe
    - Generate serialization types for XmlSerializer types used by any Service Contracts in the assembly

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值