Procedure:[Web service]
Server:
File->New->Web Site->(Visual C#) ASP.Net Web
Service
Press F5 and Run the application and Copy the URL
Client:
File->New->Project->(Visual C#) Console Application
Go to Solution Explorer-> Right Click on
Reference->Choose Add Service Reference
Paste
the URL in Address Bar & Click Go Button
Sample code:[Server]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo =
WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using
ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class Service : System.Web.Services.WebService
{
public Service ()
{
//Uncomment
the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string
HelloWorld()
{
return
"Everybody listen....";
}
}
[Client]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace trial
{
class Program
{
static void
Main(string[] args)
{
ServiceReference.ServiceSoapClient gs = new
ServiceReference.ServiceSoapClient();
System.Console.WriteLine("Response message:"+gs.HelloWorld());
System.Console.ReadLine();
}
}
}