我正在嘗試編寫一個簡單的WCF包裝器來將SyndicationFeed作爲客戶端加載。從WCF打印默認的RSS或ATOM路徑,僅客戶端
合同
[ServiceContract]
public interface IFeedService
{
[OperationContract]
[WebGet(UriTemplate="")]
SyndicationFeed GetFeed();
}
使用
using (var cf = new WebChannelFactory<IFeedService>(new Uri("http://channel9.msdn.com/Feeds/RSS")))
{
IFeedService s = cf.CreateChannel();
this.FeedItemsList.DataSource = s.GetFeed().Items;
}
問題的問題是,該服務是附加的方法名到URL(即上面的URL會叫http://channel9.msdn.com/Feeds/RSS/GetFeed),由於我希望將其擴展到任何Feed,但我並不總是知道Feed的名稱。是否有一個屬性或屬性可以指定使用默認端點地址而不是附加方法名稱?
更新添加[WebGet(UriTemplate =「」)]只讓我成爲那裏的一部分。它適用於http://channel9.msdn.com/Feeds/RSS,它改變http://channel9.msdn.com/Feeds/RSS/,但它並不適用於它被改爲http://weblogs.asp.net/scottgu/atom.aspx/
看到更新的問題更多的問題 – bendewey 2008-12-16 20:04:46