Hi,
I get this error from silverlight:
Operation named 'GetRssFeed' does not conform to the required signature. Return types must be an entity, collection of entities, or one of the predefined serializable types.
This is my domainservice class:
// TODO: Create methods containing your application logic.
[EnableClientAccess()]
public class RssService : DomainService
{
[Invoke]
public XDocument GetRssFeed(string Url)
//public string GetRssFeed(string Url)
{
XDocument RssFeed = XDocument.Load(Url);
return RssFeed.Document;//.ToString();
}
}
And this is my mainpage.xaml.cs class:
public MainPage()
{
InitializeComponent();
RssContext context = new RssContext();
context.GetRssFeed("http://www.nu.nl/feeds/rss/algemeen.rss", GetRssFeedCompleted, null);
//XDocument RssFeed = XDocument.Load("http://www.nu.nl/feeds/rss/algemeen.rss");
}
void GetRssFeedCompleted(InvokeOperation<XDocument> obj)
{
//FeedResult.Text = obj.Value;
}
private IEnumerable<Channel> getChannelQuery(XDocument xdoc)
{
//XDocument xd = (XDocument)xdoc;
return from channels in xdoc.Descendants("channel")
select new Channel
{
Title = channels.Element("title") != null ? channels.Element("title").Value : "",
Link = channels.Element("link") != null ? channels.Element("link").Value : "",
Description = channels.Element("description") != null ? channels.Element("description").Value : "",
Items = from items in channels.Descendants("item")
select new Item
{
Title = items.Element("title") != null ? items.Element("title").Value : "",
Link = items.Element("link") != null ? items.Element("link").Value : "",
Description = items.Element("description") != null ? items.Element("description").Value : "",
Guid = (items.Element("guid") != null ? items.Element("guid").Value : "")
}
};
}
}
If i change the return type XDocument in my domainservice class, i get that error. But making it a string is just fine. I googled up this error msg, there are some work arounds for custom return types. But this isnt custom. The XDocument object belongs to the .NET framework.
How can i fix this?