Test Menu

  • Commentary
  • Deals
  • Coupons

Jan 26, 2012

An Overloaded ASMX

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.

  1. At the beginning of the service, change the web service binding from this:<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> to this: <WebServiceBinding(ConformsTo:=WsiProfiles.None)>
  2. Give the web method  a message name like this: <WebMethod(MessageName:="WithID")