Tuesday, December 11, 2007

.NET Web Service Method Overloading

Some time developers required web service method to Overloading using WebMethodAttribute.MessageName Property and WebServiceBinding.

[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.None,EmitConformanceClaims=true)]


public class Service : System.Web.Services.WebService
{
public Service ()
{
//Uncomment the following line if using designed components
//InitializeComponent(); Description="Hello work for world",
}

[WebMethod(Description="Hello work for world.",MessageName="Pavan")]
public string HelloWorld()
{
return "Hello World";
}

[WebMethod(Description="Hello work for world.",MessageName="Pavan Pareta")]
public string HelloWorld(string name)
{
return "Hello India " + name;
}
}