Results 1 to 2 of 2

Thread: webmethod

  1. #1

    webmethod

    hi, how to call a webmethod in webservices?


  2. #2
    Junior Member
    Join Date
    Jun 2006
    Answers
    3

    Re: webmethod

    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();
    }


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact