Webservice method overloading

这一生的挚爱 提交于 2019-12-11 01:12:16

问题


I am able to overload the method in webservice, though on access it categorize both methods (same method with diff params) as different operations.

What is the advantage? Is there any way I can achieve calling same method from the client side and based on parameters it calls the one I need?


回答1:


Operation Overloading is a concept available in Object Oriented programming languages. However, WebServices are not limited to OO platforms. They are message oriented, where the message can be constructed/deconstructed in any platform of your choice. Since all platforms do not provide operation overloading, and since web-services are meant for integration across platforms, it is illegal for web-services to support operation overloading.

Now, the reality is slightly different. I can see several articles online where developers have done such stuff. OASIS themselves had some confusion it seems, but they finally ruled against operation overloading (see section-3.6) .




回答2:


There is no way of doing it, by rule Web Services should have Unique name. But .NET just provides an option to use the MessageName attributes for the overloaded methods.



来源:https://stackoverflow.com/questions/4519643/webservice-method-overloading

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!