Hi,
>>What should be the URITemplate for the following method.
In my mind, it will be better that just use a simple string for the Get method and then convert it to an Array (or a list) in the method, using the split method.
Your Interface should look something like this:
[OperationContract]
[WebInvoke(
Method="GET",
UriTemplate="FireSelectionRule/ruleName/lists}",
RequestFormat=WebMessageFormat.Json,
ResponseFormat=WebMessageFormat.Json,
BodyStyle=WebMessageBodyStyle.Wrapped
)
]
public IList<string> FireSelectionRule(string ruleName, string lists);
Your implementation:
public IList<string> FireSelectionRule(string ruleName, string lists);
{
IList<string> parameteres = new List<string>();
string[] pp = lists.Split(',');
parameteres = pp.ToList();
return parameteres;
}
And call it like this in your browser:
http://localhost:8731/MyServer/second/a,b,c
For more information, pease try to refer to:
http://social.msdn.microsoft.com/Forums/vstudio/en-US/2341c11e-92b3-4da4-aba5-858054f46c80/wcf-rest-webget-accepting-arrays-of-parameters?forum=wcf .
>>How do I invoke the method from JQuery
For this question, please try to refer to the following articles:
#Consuming WCF REST Services Using JQuery AJAX Calls:
http://www.codeproject.com/Articles/128478/Consuming-WCF-REST-Services-Using-jQuery-AJAX-Call .
#How to call a WCF REST Services using Jquery:
http://www.codeproject.com/Articles/182393/Create-a-REST-service-with-WCF-and-consume-it-usin .
Best Regards,
Amy Peng
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.