现在的位置: 首页 > 综合 > 正文

KBMMW-创建自定义服务

2013年01月26日 ⁄ 综合 ⁄ 共 3197字 ⁄ 字号 评论关闭

创建自定义的服务 v1.00+(适用以后版本)

kbmMW使用一个不同术语调用---服务支持的RPC,或者远程过程调用。

一个服务就是在可用被客户端通过远程过程调用访问的服务器上的一组业务逻辑(或者业务对象。这是另一个术语)。在正常的2层架构的应用程序中,服务器端通常根本不包含任何业务逻辑,有的只是一些数据库之类中的未被加工的数据形式。在多层架构中(通常为3层),服务器上有两层(或者两个服务)--数据库服务器和应用服务器。与客户端业务逻辑相关的代码(比如,特殊计算、数据库查找)均放在客户端相反,这些代码被移入了服务器端应用服务上的一个服务对象中。这样做的好处是它相比升级上百个客户端维护一个服务器更好。再进一步,它使得具有很多个类型的客户端使用业务逻辑更方便。他们可以简单调用具有业务逻辑代码的应用服务器。

这片文档将要告诉你两种创建服务的方法,简单的使用向导和手动方式。为了更好的理解服务的内部工作,强烈建议你阅读手动方法,即使你选择了使用向导方法来创建服务。

我们的例子,我们创建了一个新服务(KBMM_TIME)1.0版本,当客户端调用时来返回服务器时间。

神奇的向导

最容易创建一个新服务的方法是使用KBMMW服务向导。 File->New (->Others for Delphi 6):

这将在你被要求选择你想要创建服务类型的地方打开有初始化对话窗口的向导,你有很多依靠你的安装的注册服务。为了创建一个简单的业务对象,你需要正常的选择来基于它的自定义服务、简单服务或者事件驱动的服务之一,在向导中不同服务的描述中获取更多的信息。

本文档中示例,我们想要创建一个自定义服务

 'Extend the service' 复选框意味着你创建一个派生与服务而不是只是使用它,如果你想要创建它自己本身,向导将会告诉你添加什么到你的项目中来来使用它。

Creation of customized services
for kbmMW v. 1.00+
kbmMW supports RPC, or Remote Procedure Calls, using a different term – services.
A service is a grouping of business logic (or business objects which is another term) on the server
which can be accessed by clients through remote procedure calls.
In a normal 2-tier application, the server side often does not contain any business logic at all, but
only the raw data in the form of a database of some kind. In the n-tier architecture (usually 3-tier)
there are two tiers (or servers) on the server side – the database server and the application server.
Instead of placing business related code (e.g. special calculations, lookups in databases,
screenscraping on backend host systems etc.) in the client, this code would be moved to a service
object on the server side application server.
The benefits of this are that it is much easier to maintain one server than to have to upgrade 100s of
clients. Further, it makes it much easier to have several different types of clients use the business
rules, since they would not have each of them to contain the business code themselves. They would
instead simply call the application server that contains the business code.
This document will show two ways to create services, the easy way using a wizard and the manual
way.
To better understand of the inner workings of services, it is strongly suggested that you read the
manual method even if you choose the wizard for creating new services.
For our example, we will create a new service (KBMMW_TIME) version 1.0 which will return the

server time to the client when called

The magic of wizards
The easiest way to create a new service is to use the kbmMW Service Wizard.
Find it in File->New (->Others for Delphi 6):

神奇的向导

最容易创建一个新服务的方法是使用KBMMW服务向导。 File->New (->Others for Delphi 6):

This will start the wizard with this initial dialog where you are asked to choose the type of service
you want to create. You have several choices depending on the types of registered services on your
installation. For creating a simple business object, you would normally either choose to base it on
Custom service, Simple service or Eventoperated service. Read more about the different services in
the description in the wizard.

这将在你被要求选择你想要创建服务类型的地方打开有初始化对话窗口的向导,你有很多依靠你的安装的注册服务。为了创建一个简单的业务对象,你需要正常的选择来基于它的自定义服务、简单服务或者事件驱动的服务之一,在向导中不同服务的描述中获取更多的信息。

For the example in this document we want to create a custom service.

The 'Extend the service' checkbox means you are creating a descendent of the service (adding new
functionality) instead of using it as is. If you would use as is, the wizard would tell you what to add
to your project to use it.
All services are automatically registered in the registry for the benefit of the wizard. By selecting
the 'Service administration' tab, that information can be viewed and altered.
After selecting the Custom service, click Next.

抱歉!评论已关闭.