阿帕奇 CXF |对 Web 服务调用的多个响应
我们希望使用 CXF 实现一个 Web 服务,使得对其的调用是异步的并且服务器发回多个响应。 CXF 或任何其他 Web 服务 API 是否有办法做到这一点,或者我们是否需要为此编写自己的自定义实现?
We want to implement a webservice with CXF in such a way that the call to it is asynchronous and the server sends back multiple responses. Is there a way in CXF or any other webservice API to do this or do we need to write our own custom implementation for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这似乎是一个不寻常的要求。您能详细说明一下用例吗?可能有更合适的机制来完成响应传递。
That seems an unusual requirement. Could you elaborate on the use case? There may be a more appropriate mechanism to accomplish response delivery.
如果结果确实是异步的,并且您可以让客户端侦听传入消息,那么在每个方向上使用单向消息可能是最简单的方法。
但您可以尝试的一种替代方案是以 Atom 流的形式提供结果,这样您就可以花时间来生成结果。请注意,我还没有尝试过这一点;我刚刚在文档中看到了它的描述(当时不需要它)。您可能还需要改用 RESTful 交互风格才能实现这一点,但使用 CXF 就很容易做到这一点。
If the result is really asynchronous and you can have the client listen for incoming messages, it's perhaps easiest to just use one-way messages in each direction.
But one alternative you could try instead is to deliver the results as an Atom stream, which you can take your time over producing. Be aware that I have not tried that out; I've just seen it described in the documentation (and didn't need it at the time). You might also need to switch to using a RESTful interaction style to make that work, but that's pretty easy with CXF.