wsdl :为 WebMethods 生成代理,但不为其他依赖类生成代理
假设我有一个带有 WebMethod AddUser(User userObject) 的 WebService SettingsWebService。
User 类位于 SettingsWebService 解决方案中。
当我为 SettingsWebService 生成代理时,它会为 asmx 创建一个类,其中包含 AddUser webmethod。
它还为 User 类生成一个类。
客户端现在使用
Proxy.AddUser(Proxy.User 用户)
接口。
有没有办法告诉 wsdl 不要为 User 类生成类,以便保留签名:
Proxy.AddUser(SettingsWebService.User) 用户)
客户端将拥有对代理和 SettingsWebSerice dll 的引用。
现在,我必须手动删除代理中 User 部分类的代码,并添加对 WebSettings dll 的 usings 引用。
非常感谢!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要添加 schemaInmporterExtensions在生成代理之前将元素添加到 machine.config 中。将此点指向包含 SettingsWebservice.User 类的程序集,并且不会生成代理。
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.
为什么需要这样做?如果它是 Web 服务,则无需将 SettingsWebService.dll 与代码一起分发
Why you need to do this? If it is a web service you don't need to distribute the SettingsWebService.dll with your code