Le 02/08/2020 à 05:06, Sakthivel Vellingiri a écrit :
Hi All, Any pointes are much appreciated.

OFBiz Version : 17.04.03

*Summary:*
I'm trying to use Service ECA on return of a Service method to invoke another Service method, i'm able to successfully call a service that is defined using auto-attributes, However when i invoke a service that is defined using non-auto attributes i get an error message > Error running the simple-method: java.util.HashMap cannot be cast to org.apache.ofbiz.entity.GenericValue, Is this an expected behavior or am i missing something?

*Details:*
*    Scenario 1: *Successfully able to invoke a service /updateProductCategory/ with set operation (that is defined using auto-attributes), from the return of service /createProductCategory/
    SECA Definition:
   -----------------------
    <eca service="createProductCategory" event="return">
    <condition field-name="productCategoryId" operator="is-not-empty"/>
    <set field-name="description" value="Updated" />
    <action service="updateProductCategory" mode="sync"/>
    </eca>
    Called Service Definition: (auto-attributes)
    -----------------------------------
    <service name="updateProductCategory" default-entity-name="ProductCategory" 
engine="simple"
location="component://product/minilang/product/category/CategoryServices.xml" 
invoke="updateProductCategory" auth="true">
        <description>Update an ProductCategory</description>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <auto-attributes include="nonpk" mode="IN" optional="true"/>
        <override name="productCategoryTypeId" optional="false"/>
    </service>

*Scenario 1: *Invoking a service /duplicateProductCategory with set Operation /(that is defined using non-auto-attributes), from the return of the *same service as above* i.e. createProductCategory results in an error > Error in simple-method [Duplicate a ProductCategory [file:/home/clintu2/Downloads/git/integrin_enterprise/com/integrin/erp/erp-17.12/applications/product/minilang/product/category/CategoryServices.xml#duplicateProductCategory]]: Error running the simple-method: java.util.HashMap cannot be cast to org.apache.ofbiz.entity.GenericValuenull
    SECA Definition:
    -----------------------
<eca service="createProductCategory" event="return">
    <condition field-name="productCategoryId" operator="is-not-empty"/>
<set field-name="productCategoryId" value="R${productCategoryId}" />
    <set field-name="oldProductCategoryId" env-name="productCategoryId" />
    <set field-name="duplicateContent" value="Y"/>
    <set field-name="duplicateParentRollup" value="Y"/>
    <set field-name="duplicateChildRollup" value="Y"/>
    <set field-name="duplicateMembers" value="Y"/>
    <set field-name="duplicateCatalogs" value="Y"/>
    <set field-name="duplicateFeatureCategories" value="Y"/>
    <set field-name="duplicateFeatureGroups" value="Y"/>
    <set field-name="duplicateAttributes" value="Y"/>
    <set field-name="duplicateRoles" value="Y"/>
    <action service="duplicateProductCategory" mode="sync"/>
    </eca>
    Called Service Definition: (Non auto-attributes)
    ---------------------------------
 <service name="duplicateProductCategory" engine="simple"
location="component://product/minilang/product/category/CategoryServices.xml" 
invoke="duplicateProductCategory" auth="true">
        <description>Duplicate a Product Category using from oldProductCategoryId to 
a new productCategoryId</description>
        <attribute name="productCategoryId" type="String" mode="IN" 
optional="false"/>
        <attribute name="oldProductCategoryId" type="String" mode="IN" 
optional="false"/>
        <attribute name="duplicateContent" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateParentRollup" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateChildRollup" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateMembers" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateCatalogs" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateFeatureCategories" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateFeatureGroups" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateAttributes" type="String" mode="IN" 
optional="true"/>
        <attribute name="duplicateRoles" type="String" mode="IN" 
optional="true"/>
    </service>

*Result:*
Scenario 1 succeeded
image.png

Scenaro 2 Failed
image.png

While researching the issue i came across the below thread, which suggests that the above  isssue is expected for XRPC and SOAP, but wasn't sure this is expected for SECA on service defined with non-auto-attributes

http://ofbiz.135035.n4.nabble.com/Re-How-to-pass-org-apache-ofbiz-entity-GenericValue-using-XMLRPC-td4721139.html

Hi Sakthivel,

As long as you don't call a service through  XMLRPC or SOAP, there are no relations. You send use images, but they mainly don't get through with the ASF MLs. 2 solution: you give links to these images or you send us the log with the error.

HTH

Jacques

Reply via email to