I\'m trying to call a webservice method and pass a parameter to it.
Here is my webservice methods:
[WebMethod]
[ScriptMethod(ResponseFormat =
Don't take over control of response stream manually. Just change your webservice method a little as below:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetHelloWorld()
{
return "HelloWorld";
}
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetHelloWorldWithParam(string param)
{
return "HelloWorld" + param;
}
Make sure you add [ScriptMethod(ResponseFormat = ResponseFormat.Json)] if you only want to offer Json in return. But if you dont add this, then your method will be capable of handling both XML and Json request.
P.S. Make sure your web service class is decorated with [ScriptService]