ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
### 服务(Service) > OFBiz中所有的服务必须先定义好, 不允许调用未定义的服务, > OFBiz里的Service实现非常灵活, 支持很多种引擎的实现方式. #### 配置文件特征 > 是一套标准XSD约束的XML标签, > 它存放在[newlearn]模块下的[servicedef]目录下, > 文件命名为[services.xml] > >[warning] 注意: 为了确保所有服务配置文件能很容易的被识别且方便多人维护, 这里要对开发人员作出编码规范的约束, 要求所有服务配置文件必须是[services]前缀, 且每个模块默认的[services.xml]不能删除和更名, 系统启动后默认读取此文件作为模块服务定义的总入口. #### 使用 > - 在[controller.xml]中按事件调用: ` <event type="service" invoke="createPlanItem" /> ` > - 在[Screens.xml]中做服务调用: ` <service service-name="performFindList" result-map="result"/> ` #### 文件内容示例如下 ~~~ <service name="createLearnPlan" default-entity-name="LearnPlan" engine="entity-auto" invoke="create" auth="true"> <description>Create a LearnPlan</description> <auto-attributes include="nonpk" mode="IN" optional="true"/> </service> <service name="deleteLearnPlan" default-entity-name="LearnPlan" engine="simple" auth="true" invoke="deleteLearnPlan" location="component://newlearn/script/org/apache/ofbiz/newlearn/NewLearnService.xml"> <description>Delete a LearnPlan</description> <auto-attributes include="pk" mode="IN"/> </service> ~~~