wsdl.exe:在操作中具有相同元素名称时如何生成代理代码?
我有一个包含许多操作的 WSDL 文件。但每个操作soap主体都有相同的元素名称,但位于不同的命名空间中。例如操作1有soap.body.op1:Service 操作2有soap.body.op2:Service,其中op1和op2是命名空间前缀。
当我使用 wsdl.exe 生成代理代码时,他生成了 Service1 和 Service2 类,但是如果在 wsdl 中服务 1 和 2 的顺序发生更改,或者添加了新的服务 3 ,则维护代理代码将变得困难。
有没有办法根据wsdl操作生成Service1和Service2类名,而不是标签名?
所以我会得到类名称为Operation1和Operation2,而不是Service1和Service2。? 谢谢大家。
I have a single WSDL file with many operation. But each of the operation soap body has the same element name , but in different namespaces. e.g operation1 has soap.body.op1:Service
and operation 2 has soap.body.op2:Service , where op1 and op2 are namespace prefixes.
When i generate my proxy code using wsdl.exe , he generated classes as Service1 and Service2, but if the order is changed in wsdl for service 1 and 2 , or if a new service 3 is added, it becomes difficult to maintain the proxy code.
Is there a way to generate the Service1 and Service2 class names based on the wsdl operation , instead of the tag name?
So i would get class names as Operation1 and Operation2 , instead of Service1 and Service2.?
Thanks all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕 wsdl.exe 没有用于调整它从 WSDL 文档生成的源代码的开关。
使其更易于维护的唯一方法是获得质量更高的 WDSL 文档。如果您可以更改此设置,则可以添加自定义 命名空间和名称到通过向 ServiceContract 属性添加更多信息来更改您的服务类:
这将生成如下客户端代码:
I'm afraid that wsdl.exe has no switches for tweaking the source code that it generates from a WSDL document.
The only way to make it more maintainable is to get a better quality WDSL document. If you are in a position to change this, you can add custom Namespace and Name to your service class by adding more information to the ServiceContract attribute:
This will generate client code like: