开发者

REST WCF Service - Consume QueryString Parameters

开发者 https://www.devze.com 2023-02-19 22:37 出处:网络
I have this REST WCF service. [WebInvoke(UriTemplate = \"/GetNames/{Category}?order=asc\", Method = \"POST\", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)]

I have this REST WCF service.

[WebInvoke(UriTemplate = "/GetNames/{Category}?order=asc", Method = "POST", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json)] 
public List<Names> GetNames(string Category)
{
    //Code to retrieve Names by category.
}

The Category parameter is mapped to {Category} in the Uri.

But how can I map the order query string in the Uri to this method?

Adding the order as a parameter method is not worki开发者_Go百科ng.

please help. thanks in advance.


Have you tried - "/GetNames/{Category}?order={ordering}" in the Uritemplate and in the function

public List<Names> GetNames(string Category, string ordering)
{
  //Code to retrieve Names by category.
}
0

精彩评论

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