Previous | Home | Next |
How to Use web Services in Console Application using C#
Step 1: Open a new project and select console Application. press on Ok.
Step 2. Click on Add service reference a new window open Click on Advance,
A new window open click on Add Web reference and copy the URL of your running service and paste it to the URL space in new window shown below and click on Go. Click on Add reference but remember your Web reference name.
The Service will be added in your project
Step 3: Written the following code in your Program (Program.cs)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net; namespace Circlearea { class Program { static void Main(string[] args) { localhost.Service lo = new localhost.Service(); Console.Write("Please enter the value="); int area = Convert.ToInt32(Console.ReadLine()); double fr=lo.CircleArea(area); Console.WriteLine("Area is =" + fr); Console.ReadLine(); } } }
Step 4: Run the Application
Previous | Home | Next |