Спасибо.
Через List работает, даже аттрибут [Serializable] не нужен.
Интерестно, почему не работало через IEnumerable?
Вот рабочий пример:
<%@ WebService Language="C#" Class="WebService1" %>
using System;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Collections.Generic;
using System.Xml.Linq;
using System.Linq;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService {
public class CalendarItem {
public string Title { get; set; }
public string Link { get; set; }
}
[WebMethod]
public List<CalendarItem> GetCalendarItems() {
XDocument document = XDocument.Load("http://newsru.com/plain/rss/all.xml");
var items = from item in document.Descendants("item")
select new CalendarItem {
Title = item.Element("title").Value,
Link = item.Element("link").Value
};
return items.ToList();
}
}
Данное сообщение получено с сайта GotDotNet.RU
Последний раз редактировалось 08 May 2008 03:13
|