Starting to learn ofbiz, I am following the tutorial here:

https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Tutorial+-+A+Beginners+Development+Guide#OFBizTutorial-ABeginnersDevelopmentGuide-SecureYourApplicationbyAuthentication

Now I am in the step to make the list form of persons editable. In this step
I need to create a service which will be used for auto-fields-service. Below
I give the code which I have done.

In the controller.xml of my componenent I have created a requestMaps as
follows:

    <request-map uri="updatePracticePerson">
        <security https="true" auth="true"/>
        <event type="service" invoke="updatePracticePerson"/>
        <response name="success" type="view" value="personForm"/>
        <response name="error" type="view" value="personForm"/>
    </request-map>

Moving now to the PracticeScreens.xml i have the following for personForm:

    <screen name="personForm">
        <section>
            <actions>
                <set field="headerItem" value="personForm"/>
                <set field="titleProperty"
value="PageTitlePracticePersonForm"/>
                <entity-condition entity-name="Person" list="persons"/>
            </actions>
            <widgets>
                <decorator-screen name="CommonPracticeDecorator"
location="${parameters.mainDecoratorLocation}">
                    <decorator-section name="body">
                        <label text="Person List" style="h2"/>
                        <include-form name="ListPersons"
location="component://practice/widget/PracticeForms.xml"></include-form>
                    </decorator-section>
                </decorator-screen>       
            </widgets>
        </section>
</screen>

The above includes the ListPersons from PracticeForms.xml, which I have as :

    <form name="ListPersons" type="list" list-name="persons"
list-entry-name="person" target="updatePracticePerson"
paginate-target="personForm">
        <auto-fields-service service-name="updatePracticePerson"
default-field-type="edit" map-name="person"/>
        <field name="partyId"><hidden/></field>
        <field name="submitButton" title="Update"
widget-style="smallSubmit"><submit button-type="button"/></field>
        <field name="deletePracticePerson" title="Delete Person"
widget-style="buttontext">
            <hyperlink
target="deletePracticePerson?partyId=${person.partyId}"
description="${uiLabelMap.CommonDelete}" also-hidden="false"/>
        </field>
        <field name="submitButton"
title="${uiLabelMap.CommonUpdate}"><submit button-type="button"/></field>
    </form>

If you see above the ListPersons calls the service updatePracticePerson.

inside servicedef/services.xml i have the following:

     <service name="updatePracticePerson" default-entity-name="Person"
engine="simple"
           
location="component://practice/script/org/hotwax/practice/PracticeServices.xml"
invoke="updatePracticePerson" auth="true">
        <description>Create a Person</description>
        <auto-attributes include="pk" mode="IN" optional="false"/>
        <attribute name="salutation" mode="IN" type="String"
optional="true"/>
        <attribute name="firstName" mode="IN" type="String"
optional="false"/>
        <attribute name="middleName" mode="IN" type="String"
optional="true"/>
        <attribute name="lastName" mode="IN" type="String"
optional="false"/>
        <attribute name="suffix" mode="IN" type="String" optional="true"/>
    </service>



In the root of my project in the file ofbiz-component.xml i have :

     <service-resource type="model" loader="main"
location="servicedef/services.xml"/>

this to make sure that my service is loaded.

Although all of the above seem correct to me I get the following error :

    org.ofbiz.widget.screen.ScreenRenderException: Error rendering screen
[component://common/widget/CommonScreens.xml#GlobalDecorator]:
java.lang.RuntimeException: Error rendering included form named
[ListPersons] at location [component://practice/widget/PracticeForms.xml]:
java.lang.IllegalArgumentException: Error finding Service with name
updatePracticePerson for auto-fields-service in a form widget (Error
rendering included form named [ListPersons] at location
[component://practice/widget/PracticeForms.xml]:
java.lang.IllegalArgumentException: Error finding Service with name
updatePracticePerson for auto-fields-service in a form widget)


Which obviously implies that everything is not ok and there is something
wrong with my service. Could you please assist on this?

also in the logs of ofbiz I cann see that services from other components are
being loaded. but i can see the services from my component being loaded.

Thanks in advance, 
gianis




--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/create-service-updatePracticePerson-tp4648568.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to