简体   繁体   English

合同最后的网络服务?

[英]Contract-last web services?

Using CXF to create contract-last web services seems like an efficient and effective way to rapidly create either SOAP or REST based web services. 使用CXF创建契约最后的Web服务似乎是一种快速创建基于SOAP或REST的Web服务的高效且有效的方法。 However, I'm unclear/unsure of the following and I'd appreciate insight/feedback: 但是,我不清楚/不确定以下内容,我很感激见解/反馈:

  1. Are there any significant pitfalls of contract-last that I should be aware of? 合同最后是否存在重大缺陷我应该注意什么?
  2. Are there any significant issues/pitfalls of CXF I should be wary of? CXF是否有任何重大问题/陷阱我应该警惕?
  3. Between REST and SOAP which makes the most sense when using CXF ? 在REST和SOAP之间使用CXF时最有意义吗?
  1. The problem with contract last is that there is a tight coupling between your code and the WSDLs you produce. 合同最后的问题是您的代码与您生成的WSDL之间存在紧密耦合。 It means that you are limited by the impedance mismatch between Java and what an XSD supports. 这意味着您受到Java与XSD支持的阻抗不匹配的限制。 The major issue we've faced is around versioning. 我们遇到的主要问题是版本控制。 If you want to support two parallel versions, how do you do that with contract-last? 如果您想支持两个并行版本,那么如何使用contract-last? We found a cunning way to do it with XStream and separate wars but the solution is too large for this margin. 我们发现了一种使用XStream和单独战争的巧妙方法,但解决方案对于此边距来说太大了。
  2. CXF works pretty well. CXF运作良好。 We haven't hit any major problems but it's a big project and the variations of what you can do with it are also pretty big. 我们没有遇到任何重大问题,但它是一个大项目,你可以用它做的变化也很大。
  3. That depends on the consumers of your API. 这取决于您的API的消费者。 I'd advocate REST if at all possible because it's simpler, doesn't rely on incompatible SOAP libraries and scales better but some B2B organisations I've worked with prefer SOAP. 如果可能的话,我会提倡REST,因为它更简单,不依赖于不兼容的SOAP库并且可以更好地扩展,但是我使用过的一些B2B组织更喜欢SOAP。 The argument can be made that there is more tooling for creating SOAP clients automatically vs. REST. 可以说,有更多的工具可以自动创建SOAP客户端而不是REST。 That said, most large organisations (Google, Amazon etc.) prefer REST for a reason. 也就是说,大多数大型组织(谷歌,亚马逊等)都喜欢REST。

Contract last web service development is great for prototyping web services. 合同上次Web服务开发非常适合Web服务的原型设计。 Sometimes WSDL can be a pain to deal with. 有时WSDL可能很难处理。 Where I work we do everything contract first, since most of our web services have to be integrated with potentially many others and so the WSDL is usually created by the architects. 在我工作的地方,我们首先签订合同,因为我们的大多数Web服务都必须与其他许多Web服务集成,因此WSDL通常由架构师创建。

I would also go REST if possible and it won't be hard to generate RESTful services\\clients with CXF. 如果可能的话,我也会去REST,用CXF生成RESTful服务\\客户端并不困难。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM