tags:

views:

324

answers:

1

Hi,

I have a class in a wcf service for representing a set of invalid parameters,

[DataContract(Namespace = WebServiceNamespace.WsNamespace)]
public class InvalidParameterFault : FaultBase
{
    public override string GetReason()
    {
        return Resources.OneOrMoreParametersInvalid;
    }                       

    [DataMember]
    public string[] InvalidParameters { get; set; }       

    public InvalidParameterFault()
    {            
    }        
}

(Part) of the contract is defined as,

[FaultContract(typeof(InvalidParameterFault))]
[OperationContract]        
uint RegisterIndividual(RegisterIndividualPayload payload);

When I add a service reference to my test project, the wrapper it creates is as below (nothing like the original definition). Does anyone know why this is ?????????

[System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "3.0.0.0")]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlSchemaProviderAttribute("ExportSchema")]
    public partial class InvalidParameterFault : object, System.Xml.Serialization.IXmlSerializable, System.ComponentModel.INotifyPropertyChanged {

        private System.Xml.XmlNode[] nodesField;

        private static System.Xml.XmlQualifiedName typeName = new System.Xml.XmlQualifiedName("InvalidParameterFault", "http://schemas.facecode.com/webservices/2009/08/");

        public System.Xml.XmlNode[] Nodes {
            get {
                return this.nodesField;
            }
            set {
                if ((object.ReferenceEquals(this.nodesField, value) != true)) {
                    this.nodesField = value;
                    this.RaisePropertyChanged("Nodes");
                }
            }
        }

        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

        public void ReadXml(System.Xml.XmlReader reader) {
            this.nodesField = System.Runtime.Serialization.XmlSerializableServices.ReadNodes(reader);
        }

        public void WriteXml(System.Xml.XmlWriter writer) {
            System.Runtime.Serialization.XmlSerializableServices.WriteNodes(writer, this.Nodes);
        }

        public System.Xml.Schema.XmlSchema GetSchema() {
            return null;
        }

        public static System.Xml.XmlQualifiedName ExportSchema(System.Xml.Schema.XmlSchemaSet schemas) {
            System.Runtime.Serialization.XmlSerializableServices.AddDefaultSchema(schemas, typeName);
            return typeName;
        }

        protected void RaisePropertyChanged(string propertyName) {
            System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
            if ((propertyChanged != null)) {
                propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
            }
        }
    }
+1  A: 

Assuming you're using Visual Studio, there are some settings in the "Add Service Reference" -> "Advanced" dialog that allow you to specify the type for generated collections. Is that set to generate System.Array (the default, I think) or something else?

Also, this partial class does not seem to derive from FaultBase at all. Did you perhaps select "Add Web Reference" - convincing Visual Studio to implement a classic-style ASMX web service client instead of a WCF client?

Lars Kemmann