This post originated from an RSS feed registered with .NET Buzz
by Jason Nadal.
Original Post: Web Service Overloads?
Feed Title: Jason Nadal
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/jnadal/Rss.aspx
Feed Description: Restless C#ding
I just discovered overloads for webmethods cannot have the same name. Don't other platforms have the concept of differing method signatures with the same name?
Here's the fix to change the name of one or both methods via an alias:
[WebMethod(MessageName="MethodAlias")] public ReturnType MethodName(string param1) { return MethodName(param1,"HardParam2"); }
[WebMethod(MessageName="MethodAliasPlain")] public ReturnType MethodName(string param1, string param2) { //actual service code here. }