We’ve been coping with this issue for quite some time and find only half useful solutions.
Our main method in Web Service application called “MainVoid” needs to have additional parameter for example:
MainVoid (before):
public void MainVoid (string Parameter1, int Parameter2, bool Parameter 3)
Into (MainVoid (before)):
public void Main Void (string Parameter1, int Parameter2, bool Parameter 3, int Parameter4)
We have few application which used this void but we don’t want to rebuild/republish all. The ideal scenario would be that old applications would call void with one parameter less, whereas “new” applications would could the same void but with one parameter more.
As I know, unfortunately using optional parameters is not possible in WCF which is quite a big issue.
Then we tried to overload functions bellow
[OperationContract]
With similar approach to this: overloading methods in web service
Debugging Web Service works fine (if no parameter is passed then optional parameter default value is inserted).
In other project which calls the WebService the Intellisense finds overloaded methods (it offers 2 options, instead of one).
But when we run debug on the application which is calling web service the debugger wants all parameters so it throws an error.
Sorry for such a long post but I’ve tried to explain our problem as best as possible. The second approach demands changing of reference files in other projects so it’s not a wanted solution.
Guess there is no other way than creating 2 voids with different name?
Using different names would at the very least be clearer IMO. Overloading has enough oddities even within plain C#, without any optional parameters or web service bits going on.
Another alternative is to change the web service to use a custom parameter type, and add more information to that parameter type over time.