Spring Webservices:什么是好的起点?

发布于 2024-09-18 04:36:44 字数 298 浏览 3 评论 0原文

我对 Spring Web Services 完全陌生,所以我应该开始关注什么概念,我应该在哪里寻找它们,以及一般来说,您建议采取哪些步骤来加快使用 Spring Webservices模块。

注意:我需要为不同的应用程序构建 Web 服务并使用 Web 服务,并且我过去从未使用过 Web 服务,我正在考虑 Spring WS 选项,因为这两个应用程序都是使用开发的Spring Framework,这是一个寻找 Spring WS 的好假设吗?

任何有关讨论方法的指导和建议将不胜感激。

谢谢。

I am totally new to Spring Web Services and so what concept should I start concentrating on and where should I be looking for them and in general what steps would you recommend to get to speed with Spring Webservices Module.

Note: I have an requirement to build Web Service for and consume Web Service from different application and I have never worked with Web Service in the past, I am looking at Spring WS option because both application are developed using Spring Framework, is this a good assumption to look for Spring WS or not ?

Any guidance and suggestion for discussion kind of approach would be highly appreciated.

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

迷路的信 2024-09-25 04:36:44

(...)我正在考虑 Spring WS 选项,因为这两个应用程序都是使用 Spring Framework 开发的,这是一个寻找 Spring WS 的好假设吗?

这不是一个错误的假设(Spring WS 和 Spring 之间的不良集成将是一个彻头彻尾的讽刺),但您不应该因为您的应用程序正在使用 Spring 而排除其他堆栈。 JAX-WS 堆栈(如 Apache CFX 或 JAX-WS RI)也提供 Spring 集成。

就我个人而言,我喜欢 JAX-WS(我将其用于契约优先 Web 服务),并且,虽然如果没有有关您的需求的更多详细信息,很难更具体,但我根本不认为 Spring WS提供优于 JAX-WS 的任何优势,在您的情况下,我可能会选择 Apache CXF

也许看看其他人在这个上一个SO问题中所说的内容(请阅读所有答案,接受的答案并不是真正的答案)我认为很好)。

(...) I am looking at Spring WS option because both application are developed using Spring Framework, is this a good assumption to look for Spring WS or not?

It's not a wrong assumption (bad integration between Spring WS and Spring would be a total irony) but you should not exclude other stacks on the fact your applications are using Spring. JAX-WS stacks (like Apache CFX or JAX-WS RI) provide Spring integration as well.

Personally, I like JAX-WS (that I use for contract-first web services) and, while it's hard to be more specific without more details about your requirements, I simply don't think that Spring WS offers any advantages over JAX-WS and I would probably go for Apache CXF in your case.

Maybe have a look at what others are saying in this previous SO question (please read all answers, the accepted one is not really good in my opinion).

雨轻弹 2024-09-25 04:36:44

您的协议要求是什么?您必须使用 SOAP,还是可以自由地通过 HTTP 使用您自己的 XML 编组(例如 RESTful 方法)?

如果您必须使用 SOAP,请参阅我为 Spring WS Web 服务编写的指南。如果您可以随意使用自己的轻量级 RESTful Web 服务,请参阅我编写的这个示例在 RESTful Web 服务上。

What are your protocol requirements? Do you have to use SOAP, or are you free to use your own XML marshalling over HTTP (e.g. a RESTful approach)?

If you must use SOAP, then see this guide I wrote to Spring WS web services. If you're free to use your own lightweight RESTful web services, then see this example I wrote on RESTful web services.

梦初启 2024-09-25 04:36:44

由于您提供的推理,我不会仅使用 Spring WS。您需要确定更多的功能需求,例如:

  • 您可以使用标记(JSON、XML 等)
  • 吗?您是否应该提供内容协商
  • ?您是否需要提供复杂的对象(即 SOAP,如 james 建议的那样)?
  • 您是否提供 RESTful 服务

?在过去的几年里,我们经常使用 Web 服务,并且似乎有一些用于创建它们的主要项目:

还有其他分支,例如 Spring WS,甚至 Spring MVC,但您需要评估哪个最有效。

我个人经常使用 Jersey,它也提供 Spring 集成。 Jersey 还有一个很棒的 HTTP 客户端 用于消费服务,但不要混淆创建Web 服务类似于使用 Web 服务。它们是单独的工作流程,您可以为两者使用单独的第三方项目(例如 Apache HTTP Client< /a> 用于消费,Jersey 用于生产)。

Spring WS 可能最适合您,但我的建议是不要仅仅因为其他应用程序使用它就使用它......使用最有效并满足您的要求的东西。

I wouldn't use Spring WS ONLY because of the reasoning you provide. You need to identify more functional requirments like:

  • Can you use markup (JSON, XML, etc.)
  • Should you provide content negotiation
  • Do you need to provide complex objects (i.e. SOAP as james suggests)
  • Are you providing a RESTful service

etc.

I've worked with web services a lot in the past few years and there seems to be a few major projects for creating them:

There are other offshoots like Spring WS, or even Spring MVC, but you need to evalute which will work best.

Personally I use Jersey a lot, which also provides Spring integration. Jersey also has an awesome HTTP client for consuming services, but don't confuse creating a web service as being akin to consuming a web service. They are separate workflows and you could use separate third-party projects for both (e.g. Apache HTTP Client for consuming, and Jersey for producing).

Spring WS might work best for you, but my advice would be don't use it just because the other applications use it...use whatever works best and fulfills your requirements.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文