2015-11-04 19 views
0

我想在新的ofbiz組件中使用現有服務(createInvoice) 。apache 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> 

但也許有一個簡單的解決方案(也許有一種方法 送在服務請求圖中定位服務的位置?)。

回答

2

錯誤org.ofbiz.webapp.control.RequestHandlerException: Unknown request [createInvoice]; this request does not exist or cannot be called directly.指出組件無法找到指定的要求,它不是關於服務定義。在請求定義內部,您需要指定哪個事件服務必須處理。

您的表單調用請求,該請求要麼在組件的controller.xml中指定,要麼表單的請求必須指向已存在的記帳組件的請求。

您不必複製服務定義以在您的組件中使用它,OFBiz按名稱註冊所有服務定義併爲所有組件處理它們。

+0

謝謝。我添加了相關的請求,它工作! – Mike75

相關問題