Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Post
An Article
A Blog
A Video
An Ebook
An Interview Question
Register
Login
0
Reply
Returning Arraylistof userdefined objects From Webservice
contactashwinj
Jan 4 2005 6:50 AM
2.1k
Reply
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]
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
0
)
Next Recommended Forum
How copies files across from a UNC drive to my local drive in C# using .windows service
Can I download a word file on a server using webservice?