I started a new project on VS 2010 & .Net 4.0. For some data I had to connect to the Web Service that was build with early version of .Net framework. So I added the web service as a "Service Reference" in my project.
The web service in question has 4 overloaded search methods with "MessageName" attributes set to "search1", "search2" etc. {Not very intuitive, I know, but that's the way it is}. The one I wanted to call has the MessageName "search4".
Now when I go to my ASPX page to call the web method, I was confused not to find "search4" method listed in the intellisense. It would give me an error if I type down the method name. All the while I could see the "search4" method through my web browser.
After a bit of digging into the associated files created for each service reference, I found that in "Reference.cs" under "Reference.svcmap" this line of code:
// CODEGEN: Generating message contract since the wrapper name (search4) of message search4 does not match the default value (search3)
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/search4", ReplyAction="*")]
[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults=true)]
NS.MyProject.WS_Test.search41 search3(NS.MyProject.WS_Test.search4 request);
The auto generated code explanation sounded a bit weird to me. Expose the method as it was intended by the Web service developers. Why rename them?