[英]apache ofbiz: include existing service in own component
我想在新的ofbiz
组件中使用现有服务( createInvoice
)。
在我的componentScreens.xml文件中,我添加了:
<decorator-section name="body">
<section>
<widgets>
<screenlet title="${uiLabelMap.AccountingCreateNewSalesInvoice}">
<include-form name="NewSalesInvoice" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
<screenlet title="${uiLabelMap.AccountingCreateNewPurchaseInvoice}">
<include-form name="NewPurchaseInvoice" location="component://accounting/widget/InvoiceForms.xml"/>
</screenlet>
</widgets>
</section>
</decorator-section>
显示正常。 但是NewPurchaseInovice-form
调用服务createInvoice
,该服务在/accounting/servicedef/services_invoice.xml中定义
因此,当我的表单调用ofbiz
服务时,会指出一个错误:
org.ofbiz.webapp.control.RequestHandlerException: Unknown request [createInvoice]; this request does not exist or cannot be called directly.
一种解决方案可能是在我的组件services.xml中重新定义(复制)服务:
<service name="createInvoice" engine="simple" default-entity-name="Invoice"
location="component://accounting/script/org/ofbiz/accounting/invoice/InvoiceServices.xml" invoke="createInvoice">
<description>Create Invoice Record</description>
<permission-service service-name="acctgInvoicePermissionCheck" main-action="CREATE"/>
<auto-attributes mode="INOUT" include="pk" optional="true"/>
<auto-attributes mode="IN" include="nonpk" optional="true"/>
<override name="invoiceTypeId" mode="IN" optional="false"/>
<override name="partyIdFrom" mode = "IN" optional="false"/>
<override name="partyId" mode = "IN" optional="false"/>
<override name="description" allow-html="safe"/>
<override name="invoiceMessage" allow-html="safe"/>
</service>
但是,也许有一个更简单的解决方案(也许有一种方法可以在请求映射中指定服务的位置?)。
错误org.ofbiz.webapp.control.RequestHandlerException: Unknown request [createInvoice]; this request does not exist or cannot be called directly.
org.ofbiz.webapp.control.RequestHandlerException: Unknown request [createInvoice]; this request does not exist or cannot be called directly.
指出组件找不到指定的请求 ,这与服务定义无关。 在请求定义内,您可以指定必须处理的事件或服务 。
你的表单调用已要么在组件的controller.xml或形式的请求必须指向一个已经存在的会计组件的请求中指定的请求 。
您无需复制服务定义即可在组件中使用它,OFBiz按名称注册所有服务定义并为所有组件处理它们。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.