wcfwcftestclient

How to pass List<ABC> to WCF test client


I have DataContract as below

[DataContract]
    public class Test
    {
        public List<Validation> val { get; set; }
    }

and my OperationContract as below

public bool TestValidation(Test t, out string message)
        {
            return ValidationUtility.ValidateFields(t.val, out message);
        }

I am not getting how to set value for Test.val on WCF Test Client

enter image description here


Solution

  • Firstly, it seems like you're missing the DataMember attribute for your list.

    [DataContract]
    public class Test {
        [DataMember]
        public List <Validation> val { get; set; }
    }
    

    Also, ensure that the DataContract and DataMember attributes for Validation are set up properly as well. Then restart your WCF Test Client and try calling the service again.

    Expand the objvalidation part on the Name column. A + sign should appear next to the request parameter name. You can then add elements and fill out their properties (Value column) by expanding each individual element you've added.