Invalid enum value '' cannot be deserialized into type RRS feed

  • Question

  • Hello there,

    I have a WCF service having an enum defined as -

        public enum Operator

    DataContract declared as -

        public class PropertyQuery
            public string PropertyName { get; set; }
            public Operator Operator { get; set; }        
            public string PropertyValue { get; set; }

    OperationContract declared as -

        string GetClientData(string clientName, [Optional] PropertyQuery propertyQuery);   

    However when I send request for 'GetClientData()' using SoapUI with passing value only for first parameter 'clientName' and leaving blanks for 'propertyQuery' parameters - 


    I get following message - 

    Invalid enum value '' cannot be deserialized into type 'WCFService2.Operator'. Ensure that the necessary enum values are present and are marked with EnumMemberAttribute attribute if the type has DataContractAttribute attribute.  

    I know this error makes sense.   
    But how to make 'propertyQuery' as optional and thus 'Operator' as optional and get rid of this error.

    Please guide.

    Sunday, January 18, 2015 10:29 PM