0
Reply

Returning Arraylistof userdefined objects From Webservice

contactashwinj

contactashwinj

Jan 4 2005 6:50 AM
2.1k
HI, I M CREATING AN WEBSERVICE... IN THAT I M CREATING A WEBMETHOD WHICH RETURNS AN ARRAYLIST.. public ArrayList GetArrPeriods() { sm = new SarsImplement(); return sm.GetPeriods(); //sm is a class.. //sm.getperiods() is a function which returns an arraylist... } public override ArrayList GetPeriods() { ArrayList arr = new ArrayList(); reader = SqlHelper.ExecuteReader(this.conn_string,"GetLowerPeriod",20); while(reader.Read()) { Period period = new Period(); period.PeriodID = reader.GetInt32(reader.GetOrdinal("PeriodId")); period.PeriodDescription = reader.GetString(reader.GetOrdinal("PeriodDesc")); period.StartDate = reader.GetDateTime((reader.GetOrdinal("StartDate"))); period.EndDate = reader.GetDateTime((reader.GetOrdinal("EndDate"))); period.ParentPeriod = reader.GetInt32(reader.GetOrdinal("ParentPeriod")); arr.Add(period); } reader.Close(); return arr; } BUT WHEN I EXECUTE THE WEBSERVICE AND CALL IT IT GIVES ME FOLLOWING ERROR... System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type SarsTrial.DataObjects.Period was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically. PLS MAIL ME OR TELL ME THE SOLUTION,. CONTACT DETAILS : [email protected],[email protected]