apache ofbiz:在自己的组件中包含现有服务
apache ofbiz: include existing service in own component
我想使用现有服务 (createInvoice
)
在一个新的 ofbiz
组件中。
在我的 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.
指出组件找不到指定的request,这与service定义无关。在请求定义中,您指定必须处理哪个 event 或 service。
您的表单调用了一个 请求,该请求必须在您的组件的 controller.xml 中指定,或者表单的请求必须指向已经存在的会计组件的请求。
您不必复制服务定义即可在您的组件中使用它,OFBiz 按名称注册所有服务定义并为所有组件处理它们。
我想使用现有服务 (createInvoice
)
在一个新的 ofbiz
组件中。
在我的 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.
指出组件找不到指定的request,这与service定义无关。在请求定义中,您指定必须处理哪个 event 或 service。
您的表单调用了一个 请求,该请求必须在您的组件的 controller.xml 中指定,或者表单的请求必须指向已经存在的会计组件的请求。
您不必复制服务定义即可在您的组件中使用它,OFBiz 按名称注册所有服务定义并为所有组件处理它们。