Wednesday, 21 April 2010

Overloading Web Services

The procedure to solve this problem is very easy. Start each method with a Web Method attribute. Add Description property to add a description of web method and MessageName property to change web method name.


namespace TestOverloadingWebService

{

[WebService(Namespace = "http://tempuri.org/", Description=" <b> Function

overloading in Web Services </b>")]

public class OverloadingInWebService : System.Web.Services.WebService

{

[WebMethod(MessageName = "AddInt", Description = "Add two integer

Value", EnableSession = true)]

public int Add(int a, int b)

{

return (a + b);

}

[WebMethod(MessageName = "AddFloat", Description = "Add two Float

Value", EnableSession = true)]

public float Add(float a, float b)

{

return (a + b);

}

}

}

No comments:

Post a Comment