I suggest you read up on the service engine
http://docs.ofbiz.org/display/OFBTECH/Service+Engine+Guide
and use a xml editor that reads the xsd for services.
if you have defined your xml file with the appropriate header this
should show what will not work.
pick any servicedef/service.xml as an example.

Radoslav Tomko sent the following on 7/24/2008 12:02 AM:
> Hi,
> 
> I am trying to make "common" service for my project, and i am facing problem
> using dynamic service name.
> My common service has Map parameter, and then it calls required service
> using values from that Map.
> 
> Sample:
> 
>     Service definition:
>   
>     <service name="updateCommon" engine="simple"
>             location="com/codes/CommonServices.xml"
> invoke="updateCommon" auth="true">
>         <description>Update entity - common</description>
>         <attribute name="entityName" type="String" mode="IN"
> optional="false"/>
>         <attribute name="data" type="Map" mode="IN" optional="false"/>
>     </service>
> 
>     Service:
> 
>     <simple-method method-name="updateCommon" short-description="Update
> entity - common">
>         <!-- no problem -->
>         <set-service-fields
> service-name="update${parameters.entityName}" map-name="parameters.data"
> to-map-name="serviceParams"/>
> 
>         <!- there is problem -->
>         <call-service service-name="update${parameters.entityName}"
> in-map-name="serviceParams">
>             <results-to-map map-name="result"/>
>         </call-service>   
>     </simple-method>
> 
> 
> And I want it to call service like this (let say, I pass 'GlAccount' in
> entity-name parameter for updateCommon service):
> 
>     <service name="updateGlAccount" default-entity-name="GlAccount"
> engine="simple"
>             location="com/accounting/ledger/GeneralLedgerServices.xml"
> invoke="updateGlAccount" auth="true">
>         <description>Update a GlAccount record</description>
>         <auto-attributes include="pk" mode="IN" optional="false"/>
>         <auto-attributes include="nonpk" mode="IN" optional="true"/>
>     </service>
> 
> 
> I test that for "<set-service-fields ...>" tag the dynamic use of
> service-name is working fine, and parameters for service
> are filled correctly, but for "call service" tag it's not working. It
> gives me an error saying "Cannot locate service by
> name (update${parameters.entityName})".
> 
> I know to do that using service written in java, but this looks more
> simply :-)
> 
> Is there some way to solve that or is there any other way to do that,
> except java ?
> 
> 
> Thanx for any advance,
> 
> Radoslav Tomko
> 
> 
> 
> 
> 

Reply via email to