hi, how to call a webmethod in webservices?
Printable View
hi, how to call a webmethod in webservices?
Its just similar to call a function of a DLL.
suppose your webservice is like :
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public double GetInterest(double Principle, double ROI, double NoOfYrs)
{
return ((Principle * ROI * NoOfYrs)/100);
}
}
To call this webmethod in another aspx page, all you have to do is:
protected void Button1_Click(object sender, EventArgs e)
{
WebServiceTest.Service1 intService = new WebServiceTest.Service1();
TextBox4.Text = intService.GetInterest(System.Double.Parse(TextBox1.Text), System.Double.Parse(TextBox2.Text), System.Double.Parse(TextBox3.Text)).ToString();
}