应用程序服务器中的 Web 服务和应用程序层代码有什么区别

发布于 2024-10-12 15:01:32 字数 354 浏览 14 评论 0原文

您好,我是 n 层架构的新手,我试图找出托管应用程序层代码的应用程序服务器的功能与 Web 服务的功能之间的区别?

所以我会告诉大家我对整个n层概念的理解,我们有UI ->网络服务器->应用程序服务器上的业务逻辑/应用程序逻辑 ->数据库服务器。 (当然,也会存在负载均衡器和多个服务器实例来固定和存储流程的状态)

但具体来说,业务逻辑层不会绑定到 UI,因此它或多或少是独立的并且可以重用。

另一方面,Web 服务也提供与业务逻辑类似的功能,它不依赖于 UI,并且可以在不同情况下重用。

有人可以解释一下我上面解释的是否正确吗?正如我之前提到的,我是这方面的新手,所以如果这听起来很愚蠢或天真,请不要攻击我:)

Hello I am a newbie to n-tier architecture and was trying to find out the difference between what an application server hosting application layer of code does, and what a web service does?

So I'll tell you people my understanding of the whole n-tier concept, we have the UI -> Web Server -> business logic/application logic on an Application server -> Database Server. (Of course load balancers and multiple server instances would also be existent to fasten and store the state of processes)

But to be specific, the business logic layer would not be tied to a UI, so it is more or less independent and can be reused.

A web service on an other hand too provides functionality similar to the business logic, where it is not tied to a UI, and can be reused for different cases.

Could anybody explain if what I just explained above is right? And as I did mention earlier, I am a newbie to this, so if this sounds stupid or naive please do not bash me :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

南汐寒笙箫 2024-10-19 15:01:32

以下是对 4 层架构的快速、粗略且非常笼统的解释,我认为它最适合您的应用程序:

表示层:与外部世界的接口(网站)< br>
应用层:创建外部世界接口所需的机制(Web 应用程序框架、Web 服务)
业务逻辑层:体现/模拟/模仿您的业务流程和工作流程(算法、转换、审批流程等)的实际逻辑
数据库层:数据库以及从中查询信息所需的逻辑

通常,Web 服务不属于业务逻辑层。该层通常与数据库层一样受到保护,因为其中可能存在商业秘密或机密的做事方式,并且您通常不希望任何人直接访问该层,除非以编程方式或通过批准的接口(例如 Web 服务) )。

Web 服务、应用程序层和业务逻辑可以恰当地与可口可乐及其业务进行比较。 Joe Blow 通常使用瓶子和罐头来消费可口可乐的产品(例如,表示层中的网站),但其他企业也希望能够向其客户提供可口可乐,因此可口可乐允许他们使用碳酸水和可口可乐糖浆(例如应用层中的Web服务)。可口可乐的秘密配方(例如业务逻辑层)以及可口可乐进入商店的分销流程(例如应用层)都对消费者隐藏。 Joe Blow 并不关心它是如何进入商店的,他只知道他可以从各种来源(网站、移动客户端等)获得可乐。可口可乐也不希望人们知道它的秘密公式(商业逻辑)。如果你想要可乐,你必须通过商店或餐馆(认可的界面)。

Here's a quick, dirty, and very general explanation of a 4-tier architecture, which I'm assuming may best apply to your application:

Presentation Layer : The interface to the outside world (web site)
Application Layer : The mechanics necessary to create the interface(s) to the outside world (web application frameworks, web services)
Business Logic Layer : The actual logic that embodies/simulates/emulates your business's processes and workflows (algorithms, transformations, approval processes, etc.)
Database Layer : The database and the logic needed to query information from it

In general, web services are not part of the business logic layer. That layer is usually protected as much as the database layer, because there could be trade secrets or confidential ways of doing things in there, and you usually don't want anyone accessing that directly, except programatically or through approved interfaces (such as web services).

Web services, application layers, and business logic can be aptly compared to Coca-Cola and it's business. Bottles and cans are usually how Joe Blow consumes Coke's product (e.g. web site in the presentation layer), but other businesses want to be able to serve Coca-Cola to their customers as well, so Coke lets them use carbonated water and Coca-Cola syrup (e.g. web services in the application layer). Coke's secret formula (e.g. business logic layer), and Coke's distribution processes to get it into the store (e.g. application layer) are all hidden from the consumer. Joe Blow doesn't care how it gets into the store, he just knows he can get Coke from a variety of sources (web site, mobile client, etc.). And Coke doesn't want people knowing its secret formula (business logic). If you want a Coke, you have to go through a store or a restaurant (approved interfaces).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文