Is there any way to convert WSDL file into C# interface with operations?

194 Views Asked by At

I am trying to convert WSDL file into C# code like

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.0.30319.1")]
    [System.Web.Services.WebServiceBindingAttribute(Name = "ServiceSoap", Namespace = "http://test.com/")]
    [System.ServiceModel.ServiceContractAttribute(ConfigurationName = "ServiceSoap", Namespace = "http://test.com/" )]
    public interface IServiceSoap
    {

        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://test.com/ping", RequestNamespace = "http://test.com/", ResponseNamespace = "http://test.com/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        [System.ServiceModel.OperationContractAttribute(Action = "http://test.com/ping", ReplyAction = "*")]
        string ping();
   }

But with wsdl /serverInterface File:///C:/service.wsdl, I get the code like this:

    /// <remarks/>
    [System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "4.7.3081.0")]
    [System.Web.Services.WebServiceBindingAttribute(Name="ServiceSoap", Namespace="http://test.com/")]
    public interface IServiceSoap {

        /// <remarks/>
        [System.Web.Services.WebMethodAttribute()]
        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://test.com/ping", RequestNamespace="http://test.com/", ResponseNamespace="http://test.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
        string ping();
}

Could I anyone just let me know what tools can do it? Or what configs I may need for wsdl.exe? Thanks.

0

There are 0 best solutions below