WCF / WSDL 服务版本
我正在寻找一种版本服务的方法。
到目前为止,我们已经建立了宽松的版本控制原则。对于次要版本,我们保持向后兼容性。为了进行重大更改,我们强制使用新的主要版本。
对于主要版本,我们不介意更改服务的名称(我们可以更改名称空间,但我们选择了名称)。
对于次要版本,我们不想更改名称或命名空间,因为这会破坏依赖旧次要版本的客户端。
我的问题是:那么我们如何才能发现如何实现版本发现呢? WSDL 中似乎没有一个地方可以放置不会违反契约的“信息”。我想要的方法是告诉给定环境(例如登台与生产)当前部署的服务版本是什么。
WSDL 对此似乎很自然,因为它可以通过 HTTP-GET (REST) 进行访问,并且不需要引入非业务 SOAP 服务操作(例如 int GetCurrentVersion() )。
有什么想法吗?
I'm looking for a way to version services.
So far we've establish lax versionning principle. For minor versions, we maintain backward compatibility. For breaking change we force a new major version.
For major version, we do not mind changing the name of the service (we could have change the namespace, but we settled for the name).
For minor version, we do not want to change the name nor namespace since that would break clients relying on older minor versions.
My question is: how could we discover how to implement version discovery then? There doesn't seem to be a place in WSDL to put 'information' that wouldn't break the contract. What I want is a way to do is to tell, for a given environment (say staging vs production), what is the service version currently deployed.
WSDL seemed natural for that since it's accessible with an HTTP-GET (REST) and it doesn't require to introduce non-business SOAP service operation (e.g. int GetCurrentVersion() ).
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WSDL 确实能够包含用于添加文档的“wsdl:document”标记,但对于编程访问,您可能需要自定义的肥皂头。此博客post 展示了如何使用自定义标头。 WCF Extras 代码 有一些简洁的行为来执行自定义肥皂标头和 wsdl 文档标记。 @marc_s 对这个问题的回答是另一种方法。
WSDL does have a capability to contain "wsdl:document" tags for adding documentation but for programmatic access you'd probably want to a custom soap headers. This blog post shows how you could use the custom headers. The WCF Extras code has some neat behaviors to do both custom soap headers and wsdl document tags. @marc_s answer to this question is another approach.
WSDL 直接没有任何此类功能,但您可以创建自定义行为,例如添加描述合约版本的
wsdl:documentation
。添加影响 WSDL 的自定义行为的描述位于 我的另一个答案。操作wsdl:documentation
的完整示例位于 MSDN。WSDL directly doesn't have any such feature but you can create custom behavior and for example add
wsdl:documentation
describing the version of your contract. The description of adding custom behavior affecting WSDL is in my other answer. The full example of manipulatingwsdl:documentation
is on MSDN.