Recently, I wanted to create an overloaded function to use in a web service. In one of the methods, an ID will be accepted as a parameter to query records matching the ID. In the other method, no ID is passed in and all records are returned. Sure, I could have have given my methods different names, but what would I learn from that? This was for an asmx.
Two areas need to be modified to have overloaded web methods.
- At the beginning of the service, change the web service binding from this:<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> to this: <WebServiceBinding(ConformsTo:=WsiProfiles.None)>
- Give the web method a message name like this: <WebMethod(MessageName:="WithID")