我应该如何弥补糟糕的 WSDL?
我遇到过几个基于 SOAP 的 Web 服务示例,其中自动化工具无法构建有效的客户端。
通过研究这些示例,我相信服务用来描述自身的 WSDL 与所提供的服务并不完全匹配。也许某个地方的类型错误,不同的数据结构 - 某些东西。
我不确定最合适的回应是什么 - 如果我们假设明显的回应(让提供商修复他们的东西)不可用。
我能想到的一些选项:
- 制定固定的 WSDL?
- 破解生成的代码?
- 还有其他选择吗?
- 没有好的选择吗?
人们有哪些好的经历?什么在真实环境中有效?
谢谢
I've come across several examples of SOAP-based web services where automated tooling fails to build a client that works.
Investigating these examples leads me to believe that the WSDL the service uses to describe itself doesn't quite match the service that's being provided. Maybe a wrong type somewhere, a different data structure - something.
I'm unsure what the most appropriate response is - if we assume that the obvious one (get the provider to fix their stuff) isn't available.
Some options I can think of:
- Make a fixed WSDL?
- Hack the generated code?
- Any other options?
- No good options?
What good experiences have people had? What works in a real environment?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会尝试第一个选项,制作一个固定的 wsdl。如果这不起作用,那么您可以依靠破解生成的代码。
当然,如果服务与 WSDL 完全不同,那么您可能不太幸运地使用这两个选项。
如果你幸运的话还有另一种方法。某些 Web 服务框架支持返回动态生成的 WSDL。
我知道使用 AXIS 1.4 服务,您可以对服务 url + '?WSDL' 执行 GET 操作并获取动态生成的 WSDL。
例如
http://foo.com/service/?WSDL
I'd try for the first option, make a fixed wsdl. If that doesn't work then you could fall back on hacking the generated code.
Of course if the service is radically different from the WSDL you might not have much luck with those 2 options.
If you're lucky there's another way. Some web service frameworks support returning a dynamically generated WSDL.
I know with an AXIS 1.4 service you can do a GET on the service url + '?WSDL' and get back a dynamically generated WSDL.
e.g.
http://foo.com/service/?WSDL
首先,我会尝试确认该工具是否为 WSDL 创建了正确的绑定。如果 WSDL 正确并且该工具生成了错误的绑定,而这不会导致正确的 SOAP 请求/响应处理,则工具作者可能会提供修复或解决方法。
First I would try to confirm if the tool created a correct binding for the WSDL. If the WSDL is correct and the tool generates bad bindings which do not result in correct SOAP request / response processing, the tool author might provide a fix or a workaround.