Web Services

SOAP IN Web services

SOAP Tutorial

adplus-dvertising
How to Use web Services in ASP. Net using C#
Previous Home Next

Step 1: Run Your Service and open a new Website, Add a label and one textBox to enter radius of Circle.

Click on Add web Reference.

Copy the URL of Your running web Service and paste it in Your Web Reference window.

Click on Go

Step 2:You can change your Web reference name but you remember this. click on add Reference.

The service will be added in your application.

Step 3: Now add the Web reference (name space) in your application (shown below). written the following code in your .cs file (Default.aspx.cs).

using System;
using System.Configuration;
using System.Web;
using System.Data;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using localhost;
public partial class _Default : System.Web.UI.Page 
{
    Service ser = new Service();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
       double area = ser.CircleArea(int.Parse(TextBox1.Text));
       Label2.Text = "Area is :  " + area.ToString();
    	or="#000000">}
}

Step 4: Run your application (Necessary to running your web service which you use in your application)

Previous Home Next