Web 服务版本控制和服务器端处理 [英] Web Services versioning and server side handling

查看:38
本文介绍了Web 服务版本控制和服务器端处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制定 Web 服务版本控制策略以及如何从 SCM 的角度处理版本.

I am trying to devise a strategy for Web Services versioning and how to handle versions from a SCM point of view.

我们正在做自底向上 (JAX-WS) 服务,因此对架构的控制较少,无法遵循最佳实践的某些架构版本控制.我现在的想法是:

We are doing bottom-up (JAX-WS) services, and therefore have less control over the schema and can't follow some schema versioning of the best practices. My current thoughts are:

1) 主要变化(非向后兼容):

1) Major changes (non-backwards compatible):

  • 通过新的服务 URL(URL 版本控制)传输到 API 客户端.例如:

http://com.example/v1/MyService

http://com.example/v2/MyService

在我看来,这对客户和开发人员来说都减少了麻烦.客户端只更新服务 URL(通常在一个地方),而不是更新所有服务调用(例如使用服务名称版本控制 - MyServiceV1、MyServiceV2...).

This causes in my opinion less hassle for both the client and developers. The client just updates the services URL (generally in one place) rather than updating all the service calls (like when using service name versioning - MyServiceV1, MyServiceV2,...).

  • 在服务器端,这通过在 SVN 中标记服务来体现:MyService-[major].[minor] 例如MyService-1.0

2) 小改动(向后兼容):

2) Minor changes (backwards-compatible):

  • 这是我比较疑惑的地方.一些最佳实践涉及修改架构命名空间,这反过来又涉及为兼容的客户升级.

  • This is where I have more doubts. Some best practices, involve modifying the schema namespace which in turn involves upgrading for compatible customers.

在服务器端很清楚,因为我使用了上面的策略 ([service_name]-[major].[minor])

In the server-side is clear as I am using the strategy above ([service_name]-[major].[minor])

感谢您对上述策略的意见和对次要版本的建议.

Would appreciate opinions on the strategy above and suggestions for the minor versioning.

推荐答案

对于主要版本,我认为您走在正确的道路上,但我不会使用v",只使用数字.

For the major version I think that you are in the right path, I wouldn't use the "v" though, just the number.

对于次要版本,我没有看到太大的问题,如果它是向后兼容的,那么这意味着更改是在代码上而不是在接口上(最多它会添加一个新方法)所以你只需要处理在您即将部署新版本时正在处理的请求.但这可以通过在处理完最后一个请求后立即禁用更新服务来处理.

For the minor version I don't see that much of a problem, if it is backwards-compatible then it means that the change was on the code but not the interface (atmost it will add a new method) so you only need to handle the requests that are being processed by the time you are about to deploy the new version. But that could be handled by disabling the service for update right after the last request has been processed.

如果你打破了你可以使用的两个小变化,对于方法添加,与你对主要版本所说的相同.

If you break the two minor changes you could use, for method addition, the same strategy as you said about the major versions.

这篇关于Web 服务版本控制和服务器端处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆