25 September 2008

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.

Filed under: , ,
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker