Showing posts with label Webservice. Show all posts
Showing posts with label Webservice. Show all posts

Thursday, October 29, 2009

function overloading method in webservice.

It's not as direct like class overloding. In webservice we have to enable some settings for
enabling the function overloading. follow below steps.

1. Must Set Attributes of Web service. 2. Set binding ConformsTo = WSIProfile.None.
Sample Class with couple of overloaded methods which exposes as a webservice
Example:
Sample: using System;using System.Web;using System.Web.Services;using System.Web.Services.Protocols;
[WebService(Namespace = "
http://tempuri.org/")]// set Binding information[WebServiceBinding(ConformsTo = WsiProfiles.None)] public class Service : System.Web.Services.WebService{ public Service () { //Uncomment the following line if using designed components //InitializeComponent(); }
// Set Message Name [WebMethod(MessageName="Add int Field")] public int Add(int a, int b) { return a + b; }
// Set Message Name [WebMethod(MessageName="Add float Field] public int Add(float a, float b) { return a + b; }}