none
ServiceContract vs ServiceContractAttribute RRS feed

  • Question

  • Hello,

    It's maybe a simple question but I can't find the answer and it's bugging me ;)

    So I have generated my service interface using "svcutil xxx.wsdl xxx.xsd" (it has generated MessageContracts).

    On top of the interface and classes, it has generated things like this:

    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
    [System.ServiceModel.ServiceContractAttribute(Namespace="http://xxx", ConfigurationName="IxxxxReceiptPortType")]
    public interface IxxxxxReceiptPortType
        { ...}
    
    [System.CodeDom.Compiler.GeneratedCodeAttribute("svcutil", "4.0.30319.1")]
        [System.SerializableAttribute()]
        [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("code")]
    [System.Xml.Serialization.XmlTypeAttribute(AnonymousType=true, Namespace="http://www.xxxxx.com/schemas/XXX/xxxxxReceipt")]
    public partial class Xxxx
    {}
        

    And FYI I have my implementation like that

    public class Ack : IxxxxxxReceiptPortType
        {
    
            xxxxxxReceiptResponse IxxxxxxxxxReceiptPortType.SalesOrderAcknowledgmentReceipt(xxxxxxxxxxxxxxReceiptRequest request)
            {...}
    
    }

    It's not working yet, and I'm doing some research, but in forums, blogs etc, I often find [ServiceContract(...)] instead of my [System.ServiceModel.ServiceContractAttribute(...)], and with the same parameters.

    Is there any difference between the two? One better to use instead of the other?

    Thanks

    Thursday, August 15, 2013 11:08 PM

Answers