Share via


WSDL-First in WCF, versus WSDL-First in ASMX

I wanted to point something out regarding the WSDL-First item I posted yesterday

This is a look at the interface generated by the SvcUtil.exe tool for WCF.

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "3.0.0.0")]

    [System.ServiceModel.ServiceContractAttribute(Namespace="urn:Microsoft.Search",
         ConfigurationName="Ionic.Samples.Webservices.Sep21.IResearchServiceSoap")]

    public interface IResearchServiceSoap

    {

 

        [System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Registration",
           ReplyAction="")]

        [System.ServiceModel.XmlSerializerFormatAttribute()]

        string Registration(string registrationXml);

 

        [System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Query",
           ReplyAction="")]

        [System.ServiceModel.XmlSerializerFormatAttribute()]

        string Query(string queryXml);

 

        [System.ServiceModel.OperationContractAttribute(Action="urn:Microsoft.Search/Status",
           ReplyAction="")]

        [System.ServiceModel.XmlSerializerFormatAttribute()]

        string Status();

    }

 

It looks quite similar to the interface that you can generate using the appropriate wsdl.exe tool if you would prefer to use the ASMX (or System.Web.Services) stack that first shipped in .NET v1.1, and continues to be available in .NET 3.5.

[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")]

[System.Web.Services.WebServiceBindingAttribute(Name="ResearchServiceSoap", Namespace="urn:Microsoft.Search")]

public interface IResearchServiceSoap {

 

    /// <remarks/>

    [System.Web.Services.WebMethodAttribute()]

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:Microsoft.Search/Registration",

        RequestNamespace="urn:Microsoft.Search",

        ResponseNamespace="urn:Microsoft.Search",

        Use=System.Web.Services.Description.SoapBindingUse.Literal,

        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    string Registration(string registrationXml);

 

    /// <remarks/>

    [System.Web.Services.WebMethodAttribute()]

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:Microsoft.Search/Query",

        RequestNamespace="urn:Microsoft.Search",

        ResponseNamespace="urn:Microsoft.Search",

        Use=System.Web.Services.Description.SoapBindingUse.Literal,

        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    string Query(string queryXml);

 

    /// <remarks/>

    [System.Web.Services.WebMethodAttribute()]

    [System.Web.Services.Protocols.SoapDocumentMethodAttribute("urn:Microsoft.Search/Status",

        RequestNamespace="urn:Microsoft.Search",

        ResponseNamespace="urn:Microsoft.Search",

        Use=System.Web.Services.Description.SoapBindingUse.Literal,

        ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]

    string Status();

 

}

So as you can see, it is a very similar model. Different attributes support the different runtimes (System.Web.Services versus WCF), but it is very parallel.