Search code examples
wcfweb-servicesasp.net-4.0

WCF Service not showing my functions


I have written following code, but only first method in service shows up in client side but rest of two doesn't :(

any one guide me what could be the issue?

ServiceInterface:

[ServiceContract]
    public interface IService1
    {

       [OperationContract]
        claimantResponse SaveClaimant(claimant claimant);

        [OperationContract]
         claimantResponse RenewExpiry(claimantMin claimantMin);

        [OperationContract]
         claimantResponse getAccessCode(claimantMin claimantMin);
    }

ServiceImplementation:

 public class Service1 : IService1
    {


        public claimantResponse SaveClaimant(claimant claimant)
        {
            return new claimantBLL().SaveClaimant(claimant);
        }


        public claimantResponse RenewExpiry(claimantMin claimantMin)
        {
            return new claimantBLL().RenewExpiry(claimantMin);
        }

        public claimantResponse getAccessCode(claimantMin claimantMin)
        {
            return new claimantBLL().getAccessCode(claimantMin);
        }


    }

Data:

[DataMember]
public class claimantResponse 
    {
       private List<string> _ErrorMessage = new List<string>();

       [DataMember]
       public List<string> ErrorMessage
        {
            get { return _ErrorMessage; }
            set { _ErrorMessage = value; }
        }

       private List<int> _ErrorCode = new List<int>();

       [DataMember]
       public List<int> ErrorCode
       {
           get { return _ErrorCode; }
           set { _ErrorCode = value; }
       }

       [DataMember]
        public String FormStatus { get; set; }
       [DataMember]
        public DateTime ExaminationDate { get; set; }
       [DataMember]
        public String AccessCode { get; set; }
       [DataMember]
        public String Status { get; set; }
        [DataMember]
        public string temp2 { get; set; }
    }

running service

It shows two strange methods getdata and getdataobject instead of my own methods.. :(

Any help would be appreciated.


Solution

  • I got solution to this problem and posting here so might help any body else with same scenario:

    1) Removing [DataMember] attribute from the class and properties. 2) creating a new WCF simple service and putting same code worked.

    i did remove datamember attribute from the old service but it was not working, so i assume my service was got corrupted because it was not showing any new method that a new service did :(

    3) web.cofig would remain same from the time you you created sample of wcf and no change is required in this case.

    Thank you!