Android : Calling WebMethod from android

on Sunday, September 14, 2014


I have used the code from this answer Android services with RestFull web services


but when I try to call like this,



json = restClientService.getResponseAsJSON("http://192.168.2.242/Test.aspx/Hello", params);


my asp.net web pages webmethod doesn't get fired. I added Page_Load code looks working but I want to be able to call WebMethods rather then page itself.



protected void Page_Load(object sender, EventArgs e)
{
Response.Write(new { Hi = "Mr" });
Response.End();
}

[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public object Hello()
{
return new { Hi = "Mr" };
}
}

0 comments:

Post a Comment