如何构建三层Web服务
我想用Axis2在Apache Tomcat下创建一个Web服务(SOAP),我必须尊重三层架构:
DAO->DAO。业务逻辑层->表示层
我是网络服务新手。有这方面的分步教程吗?
I want to create a web service (SOAP) under Apache Tomcat with Axis2, and I must respect the three-tiered architecture:
DAO -> Business Logic Layer -> Presentation Layer
I'm new to web services. Is there a step-by-step tutorial for this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Web 服务中并不存在真正的表示层,除非您将服务本身视为表示层。
http://www.roseindia.net/webservices/axis2/
有大量的 DAO 信息在网络上,与任何其他应用程序相比,服务的 DAO 层没有什么特别之处。这很大程度上取决于您想要如何构建 DAO 层。我喜欢使用 Spring JDBC。
There isn't really a presentation layer in a web service, unless you consider the service itself to be the presentation layer.
http://www.roseindia.net/webservices/axis2/
There is tons of DAO information on the web, and there's nothing special about a DAO layer for a service versus any other application. A lot of this will depend upon how you want to build your DAO layer. I like using Spring JDBC.
三层架构对于不同的人来说意味着不同的事情。
一种常见的解释是(用户的层级从 #1 开始):
也可以让 #2.5 层为您执行 DAO 工作(或自定义 DAO),例如 Hibernate。
另一种解释是,#1 实际上是 Web 服务器,#2 是单独的业务逻辑服务器,其中#1 和 #2 位于单独的服务器实例中(可能位于单独的计算机或虚拟机上),以实现安全性、隔离以及能够分别扩展和发布(以及许多其他动机)。
无论如何,您应该阅读典型的 Java 服务架构,并可能更好地描述您的目标。即,您使用“表示层”,这在某些定义中对于非基于 UI 的 Web 服务没有意义。当然,Axis2 也可以成为 Web 服务的“表示层”:)
Three tiered architecture means different things to different people.
One common interpretation is (with tiers from the user starting with #1):
It's also possible to have a layer #2.5 doing the DAO work for you (or a custom DAO) such as Hibernate.
Another interpretation is that #1 is actually the web server, and #2 is a separate business logic server, where #1 and #2 live in separate server instances (likely on separate machines or VMs) for security, isolation, and the ability to scale and release separately (and many other motivations).
In any case, you should read up on typical Java serving architectures and possibly describe your goals better. I.e. you use "Presentation Layer" which in some definitions doesn't make sense for a non-UI based web service. Of course, Axis2 could be your "presentation layer" for a web service as well :)