Apache CXF 和 Spring MVC

发布于 2024-09-07 11:54:48 字数 508 浏览 0 评论 0原文

我已经建立了一个运行良好的 CXF Web 服务。我的服务主要将数据从 ftp 加载到数据库。

我想创建一个 Web 界面,调用者可以通过该界面查看其包的进度。我认为将 Spring MVC 与 CXF 集成很容易,但似乎没有任何好的解决方案。我在网上搜索过,找不到比这更简单的东西 http://ayax79.wordpress.com/2009/02/19/making-spring-mvc-and-cxf-play-well-together/

我会的原因之所以喜欢将 Spring MVC 与 CXF 集成,而不是创建独立的 Web 界面,是因为我在 CXF 服务中有一些自定义 Spring bean,我可以利用它们来启动和停止进程。

在CXF上构建一个接口有那么难吗?或者我只是没有朝着正确的方向思考?

I have set up a CXF web service which works well. My service primarily loads data from an ftp to a db.

I would like to create a web interface through which the invoker can view the progress of their package. I thought it would be easy to integrate Spring MVC with CXF but there doesn't seem to be any good solution. I searched all over the net and could not find any thing simpler than this http://ayax79.wordpress.com/2009/02/19/making-spring-mvc-and-cxf-play-well-together/

The reason I would like to integrate Spring MVC with CXF and not create a stand alone web interface is because I have some custom Spring beans with in the CXF service which I can make use off to start and stop the process.

Is it that difficult to build an interface on CXF? Or am I just not thinking in the right direction?

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

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

发布评论

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

评论(1

执手闯天涯 2024-09-14 11:54:48

您链接到的文章更多地涉及在同一 Web 应用程序中处理 1) Web 请求和 2) CXF 请求,即构建一个可以接受 MVC 页面的传统 http 请求并接受 Web 服务请求的 Web 应用程序。

该文章的作者似乎对 Spring 以及 ApplicationContext 的工作原理感到非常困惑,如 评论者 Felix 为原作者想要实现的目标提供了一个很好且简单的解决方案(在两个上下文中重用相同的 bean 定义和实例,将一些 URL 映射到 DispatcherServlet,将其他 URL 映射到 CXF 调度程序)。

如果您只是希望 Spring MVC Web 应用程序能够与 CXF 服务交互并向 CXF 服务发出请求,这很简单 - 您编写代码来使用服务,就像在与 CXF/Soap 交互的任何其他类型的应用程序中一样/etc 网络服务。

我建议您查看 Spring 手册中有关访问 JAXRPC 或 JAXWS Web 服务的以下部分:

您可以选择简单地生成 为您的客户端代理使用 wsdl2java 等工具的 CXF 服务。请注意,我链接到的此页面上的接下来两个选项“JAX-WS Proxy”和“JAX-WS Dipatch API”在功能上与上面的 Spring 选项执行相同的操作(在运行时创建动态代理)。

The article you linked to has more to do with handling 1) web requests and 2) CXF requests within the same webapp, i.e. building a web application which can accept traditional http requests for MVC pages and also accept web service requests.

The author of that article seems to be pretty confused about Spring and how ApplicationContexts work, as the commenter Felix provides a good and simple solution for what the original author wants to accomplish (reuse the same bean definitions and instances within two contexts, having some URLs mapped to DispatcherServlet and other URLs mapped to a CXF dispatcher).

If you simply want your Spring MVC web application to be able to interact with and make requests to a CXF service, this is simple - you write code to consume the services as you would in any other type of application that interacted with a CXF/Soap/etc web service.

I'd recommend taking a look at the following sections in the Spring manual about access JAXRPC or JAXWS web services:

Another option that you have is to simply generate client proxies for your CXF service using a tool like wsdl2java. Note that the next two options on this page I linked to, "JAX-WS Proxy" and "JAX-WS Dipatch APIs" do the same thing functionally as the Spring option above (creating a dynamic proxy at runtime).

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