ofbiz学习笔记--编写服务的注意事项

本文介绍如何在OFBiz中创建并配置服务。主要包括:创建服务定义文件的目录结构、在控制器中为请求设置入口及响应、在启动时加载服务定义等步骤。
Step - 1: Create directory by name "servicedef" in component directory "practice". This directory will contain all the service definition files e.g. services.xml, secas.xml.
[color=red]Note :[/color] If it is a service which is written in Java then it will be placed in "src" directory and if it is a service which is written in minilang then it will be placed in script directory. e.g. for java applications/party/src/org/ofbiz/party/party/PartyServices.java and for minilang applications/party/script/org/ofbiz/party/party/PartyInvitationServices.xml. Respective class path and file path will be mentioned in the service definition.
*Step - 2 :*In controller you have to create an entry for the request for the execution of a service and set the response like

[color=red]<request-map uri="createPracticePerson">
<security https="true" auth="true"/>
<event type="service" invoke="createPracticePerson"/>
<response name="success" type="view" value="PersonForm"/>
</request-map>[/color]Step - 3: Now all the services which you have written needs to be loaded when server starts so you need to do an entry for service definition in ofbiz-component.xml file which will be like

[color=red]<service-resource type="model" loader="main" location="servicedef/services.xml"/>[/color]So whenever you make any change in any service definition then you must restart the server to have changes in effect.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值