I am building a RESTful service as below with 2 methods (NOTE: I have the ASPNETCompatilibilityMode set to true):
[WebInvoke]
string TestMethodA()
{
string test = HttpContext.Current.Request.Form["xml"];
}
[WebInvoke]
string TestMethodB(string res)
{
string xml = res;
}
Now when building the client in order to pass parameter to MethodA i do the following:
request.AddParameter("xmlString", HttpUtility.HtmlEncode(requestBody));
And for sending message to MethodB i do the following:
request.AddParameter("text/xml",requestBody, ParameterType.RequestBody);
Now the question is:
How does the client know on how to pass the parameter? The client is not aware of the server implementation.
The client that sends the request is using RestSharp Api.