【问题标题】:Any ideas on a WCF Interceptor for a REST WebGet request to change the Url/Querystring parameters关于 WCF 拦截器的任何想法,用于更改 Url/Querystring 参数的 REST WebGet 请求
【发布时间】:2010-05-20 12:49:20
【问题描述】:

是否有人知道我可以在 WCF 中拦截 REST Get 请求的方法,例如,我可以更改任何查询字符串参数的值。因此,在 WCF 评估 WebGet 属性的 UriTemplate 并能够对其进行编辑之前,我需要运行一些代码,然后返回它将用于继续处理请求的值。

任何帮助将不胜感激

安德鲁

【问题讨论】:

    标签: c# .net wcf rest


    【解决方案1】:

    这个小 sn-p 向您展示了如何更改/更改 url:

        /// <summary>
        /// Interface for communicating with twitter.com.
        /// </summary>
        [ServiceContract]
        public interface ITwitterClient
        {
            [OperationContract]
            [WebGet(UriTemplate = "statuses/user_timeline/{twitterName}.xml?count={numberOfTweets}",
                BodyStyle = WebMessageBodyStyle.Bare,
                RequestFormat = WebMessageFormat.Xml,
                ResponseFormat = WebMessageFormat.Xml)]
            Statuses PublicTimeline(string twitterName, int numberOfTweets);
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2023-03-19
      • 1970-01-01
      • 1970-01-01
      • 2019-10-04
      • 2018-05-17
      • 2023-01-13
      • 1970-01-01
      相关资源
      最近更新 更多