创建协议适配器的反馈/模式
我有一个当前返回域对象的后端系统。我想建立一个 REST &使用 mule 的 SOAP 前端。为了创建基于 REST 或 SOAP 的响应,并确保后端与协议无关,我正在考虑创建两个协议适配器(REST 和 SOAP)。我不清楚是否为服务创建一个 mule 翻译器更好,它理解协议并委托生成适当的响应,或者只是为服务创建两个类接口(使用 JAX-RS/JAX-WS 注释) 。
我没有找到太多关于该主题的文献、最佳实践或设计模式。有人可以向我指出一些有用的材料或提供他们的意见吗?
I have a backend system that currently returns a domain object. I want to build a REST & SOAP front end using mule. To create responses that are REST or SOAP based, and ensure that the backend is protocol agnostic, I am thinking about creating two protocol adapters (REST and SOAP). It is unclear to me if it is better to create a mule translator for the service, which understands the protocol and delegates to generate an appropriate response, or just create two class interfaces (using JAX-RS/JAX-WS annotations) to the service.
I'm not finding much literature, best practices, or design patterns on the subject. Can someone point me to some useful material or provide their opinions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编写用于消息格式化的转换器是浪费时间。
您应该使用 JAX-RS/JAX-WS 注释编写服务类,两者都存在传输。
对于 REST 服务,您可以使用 Jersey 传输:
http://www.mulesoft.org/documentation/display/JERSEY/User 's+Guide
对于 SOAP 服务,您可以使用 CXF 传输(也支持 JAX-RS):
http://www.mulesoft.org/documentation/display/CXF /Building+a+web+service
注意:您根本不需要 mule,Jersey 和 CXF 都运行在像 tomcat 这样的 servlet 容器中。
Writing transformers for message formatting would be a waste of time.
You should write service classes with JAX-RS/JAX-WS annotations, transports exist for both.
For a REST service you can use the Jersey transport:
http://www.mulesoft.org/documentation/display/JERSEY/User's+Guide
For SOAP service you can use the CXF transport (also supports JAX-RS):
http://www.mulesoft.org/documentation/display/CXF/Building+a+web+service
Note: You don't need mule for this at all, both Jersey and CXF run in a servlet container like tomcat.