组合的 JAX-RS 和 JAX-WS
是否有一种框架、库或技术可以将 JAX-RS 和 JAX-WS(或等效功能)组合成一个组合服务,其方式类似于在 WCF 中为同一服务使用两个端点(一个 SOAP 和一个 REST)?
Is there a framework, library or technique that combines JAX-RS and JAX-WS (or equivalent functionality) into one combined service in a similar way to using two endpoints (one SOAP and one REST) for the same service in WCF?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Apache CXF 可以完成这项工作。了解更多信息,请访问 http://cxf.apache.org/docs/frontends.html
Apache CXF can do the job. Read more at http://cxf.apache.org/docs/frontends.html
使用标准的 tomcat 配置就可以实现这一点。只需对服务使用单独的 URL。我决定将 JAX-WS 服务放在“SOAP/”后面,将其他服务放在小写字母后面。如果您想在 URL 中使用“rest”,则更容易,但对于最终用户来说看起来不太好。不要忘记也添加 sun-jaxws.xml。我留下了 `init-params,因为它们对于标准化 URL 很有用。如果您愿意,可以将它们全部删除。
It's possible with a standard tomcat configuration. Just use separate URLs for the services. I decided to put the JAX-WS service behind "SOAP/" and the others behind lowercase letters. If you want to use "rest" in the URL, it's even more easy, but not looking that nice for end users. Don't forget to add a sun-jaxws.xml, too. I left the `init-params as they are useful for normalized URLs. You can drop all of them if you wish.
Mikhail 答案的附加组件,CXF 配置示例。更多信息位于 http:// /cxf.apache.org/docs/jax-rs-and-jax-ws.html#JAX-RSandJAX-WS-JAXRSandJAXWS
更新:Peter Szanto 在 https://github.com/ExampleDriven/cxf-example
Addon to Mikhail's answer, example of CXF's configuration. More info is at http://cxf.apache.org/docs/jax-rs-and-jax-ws.html#JAX-RSandJAX-WS-JAXRSandJAXWS
Update: Peter Szanto created a maven project at https://github.com/ExampleDriven/cxf-example