开发者

Any ideas on a WCF Interceptor for a REST WebGet request to change the Url/Querystring parameters

开发者 https://www.devze.com 2022-12-30 19:46 出处:网络
Does any one know of a way I can intercept a REST Get request inside WCF, so for example I could change the value of any of the querystring parameters.开发者_StackOverflowSo I need to have some code r

Does any one know of a way I can intercept a REST Get request inside WCF, so for example I could change the value of any of the querystring parameters. 开发者_StackOverflowSo I need to have some code run, prior to WCF Evaluating the UriTemplate of the WebGet attribute and be able to edit it, before returning the value which it will use to continue processing the request.

Any help would be greatly appreciated

Andrew


This little snippet shows you how you can change/alter the 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);
    }
0

精彩评论

暂无评论...
验证码 换一张
取 消