将 DAO 公开为 Web 服务
谁能给我指出将 DAO 公开为外部 Web 服务的文档方向?目前,在我的应用程序中,我们遵循 DAO ->服务-> UI 分层架构。一切都在应用程序内部,我们的 DAO 通过 Spring JDBC 访问数据库,并且服务仅对 Web 应用程序可见。
我们现在需要公司内部的下游系统来访问我们创建的 DAO。我需要知道公开我们的 DAO 需要付出什么努力,以及执行此任务需要哪些其他技术(如果有)。
另外,我会公开 DAO 本身还是服务吗?
Can anyone point me in the direction of documentation for exposing a DAO as an external web service? Currently, in my application we follow a DAO -> Service -> UI layered architecture. Everything is internal to the app, our DAOs access the DB through Spring JDBC and the services are visible only to the web application.
We now have a need for downstream systems within my company to access the DAOs we've created. I need to know what the effort would be to expose our DAOs and what, if any, other technologies I would need to perform this task.
Also, would I expose the DAOs themselves or the services?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我想我没有完全理解这个问题。您必须创建为 DAO 执行 CRUD 操作的服务操作,以及 DAO 执行的任何特殊数据处理的操作。您已经通过服务向当前的 UI 公开了 DAO。您不能简单地使用该服务作为面向外部的服务的模板吗?
I guess I don't fully understand the problem. You'll have to create service operations that do CRUD operations for you DAOs, along with operations for any special data processing your DAOs perform. You already expose the DAOs via service to your current UI. Can you not simply use that service as a template for your externally facing service?
如果我是您,我会将 DAO 包装在 Web 服务中。因此,首先定义 wsdl,然后生成与该 wsdl 相关的 java 代码。然后,在 webservice 实现中,只需将实体 bean 手动复制到此 webservice bean 中即可。如果这太乏味的话,我猜你可以使用 bean copy utils。
不确定是否可以在 java2wsdl 风格的 Web 服务开发中直接使用实体 bean,但这似乎是一个坏主意,因为在这种情况下,实体 bean 和 Web 服务接口之间没有抽象层。
If I were you, I'll just wrap the DAOs in a webservice. So, first define the wsdl, then generate the java code that goes with that wsdl. Then, in the webservice implementation, just hand-copy the entity beans into this webservice beans. Guess you could use bean copy utils if that is too tedious.
Not sure if you can use the entity beans directly in java2wsdl style webservice development, but that seems like a bad idea because you don't have an abstraction layer between entity beans and webservice interface in that case.