wsdl : Generate Proxy for the WebMethods but not the other dependent classes

那年仲夏 提交于 2019-12-23 05:06:03

问题


Say, I have a WebService SettingsWebService with a WebMethod AddUser(User userObject).
The User class is in the SettingsWebService solution.
When i generate a proxy for the SettingsWebService it creates a class for asmx which contains the AddUser webmethod.
It also generates a class for the User class.

The client now uses

Proxy.AddUser(Proxy.User user)

interface.

Is there any way to tell wsdl to not generate a class for the User class, so that the signature remains :

Proxy.AddUser(SettingsWebService.User user)

The Client will have a reference to the proxy and the SettingsWebSerice dlls.


Right now I am having to manually remove the code for the User partial class in the proxy and add a usings reference to the WebSettings dll.



Many thanks in advance!


回答1:


You'll need to add a schemaInmporterExtensions element to your machine.config before generating the proxy. Make this point to the assembly which contains your SettingsWebservice.User class and a proxy will not be generated.




回答2:


Why you need to do this? If it is a web service you don't need to distribute the SettingsWebService.dll with your code



来源:https://stackoverflow.com/questions/1900701/wsdl-generate-proxy-for-the-webmethods-but-not-the-other-dependent-classes

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