I have written REST service in C#. Here is the sample.
[ScriptService]
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class TradeRestService : System.Web.Services.WebService
{
[WebMethod]
public string HelloWithRequest(String request)
{
return "You sent "+request;
}
[WebMethod]
public string HelloWithoutRequest()
{
return "Hello without request";
}
When I call the REST service from Advanced Rest Client, I can only call HelloRequest() method successfully. I cannot pass parameters to the methods which accept them.
When I call HelloRequest() method with parameter, I get the error.
System.InvalidOperationException: Missing parameter: request.
at System.Web.Services.Protocols.ValueCollectionParameterReader.Read(NameValueCollection collection)
at System.Web.Services.Protocols.HtmlFormParameterReader.Read(HttpRequest request)
at System.Web.Services.Protocols.HttpServerProtocol.ReadParameters()
at System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()
Can anyone tell me how to pass parameter? Which option to use?