microkarl Posted April 13, 2006 Posted April 13, 2006 Hi all, I have a question about web methods in .NET Web Service. I know that it is illegal to have overloaded web methods in web service. But why? Does anyone know? Can I get some information about it somewhere??? Thanks, Carl Quote Donald DUCK : YOU ARE FIRED!!!
Administrators PlausiblyDamp Posted April 14, 2006 Administrators Posted April 14, 2006 It's a restriction on how web services work, all methods need a unique name. With .Net though you can use the MessageName parameter of the WebMethod attribute to work round this restriction - simply give each overload a different messge name. [WebMethod(MessageName="HeloWorld")] public string HelloWorld() { return "Hello World"; } [WebMethod(MessageName="HelloPlace")] public string HelloWorld(string place) { return "Hello " + place; } This will give the methods different names in the WSDL, however if you then create a client to the webservice .Net will just give you an overloaded HelloWorld method. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.