Service results displayed in form

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Service results displayed in form

Grant Edwards-2
Hi,

In a nutshell, what i am trying to do is run a service (form a form) and
display the results to the "success" view-map"

Here is the form ....

<form name="simpleJob" type="single"
target="executeSimpleJob?response=${responseXmlDoc}" > <!-- (see
controller.xml) -->
        <field name="requestorId" title="Requestor Id"><text
size="10"/></field>
        <field name="requestorType" title="Requestor Type"><text
size="30"/></field>
        <field name="requestUrl" title="Request Url"><text
size="90"/></field>
        <field name="requestMethod" title="Request Method"><text
size="10"/></field>
        <field name="submitButton" title="Spank me !!"
widget-style="standardSubmit"><submit button-type="button"/></field>
    </form>


service.xml .....

<service name="executeSimpleJob" engine="java" export="true"
location="SomeService" invoke="executeRequest">
        <description>Execute a job</description>
        <attribute name="requestorId" type="String" mode="IN"
optional="false"/>
        <attribute name="requestorType" type="String" mode="IN"
optional="false"/>
        <attribute name="requestUrl" type="String" mode="IN"
optional="false"/>
        <attribute name="requestMethod" type="String" mode="IN"
optional="false"/>
        <attribute name="responseXmlDoc" type="String" mode="OUT"
optional="false"/>
    </service>

controller.xml .....

<request-map uri="executeSimpleJob">
        <event type="service" invoke="executeSimpleJob"/>
        <response name="success" type="view" value="results"/>
        <response name="error" type="view" value="error"/>
    </request-map>



The service in brief .....

public class SomeService {

    public static Map executeRequest(DispatchContext dctx, Map context) {


        String response = "This is an xml doc !!;



        Map result = ServiceUtil.returnSuccess(); // gets standard Map for
successful service operations
        result.put("responseXmlDoc", "some other doc"; // puts output
parameter into Map to return
        return result; // return Map

    }



And now for the final display .....

<screen name="results">
        <section>
            <widgets>
                <decorator-screen name="CommonDecorator">
                    <decorator-section name="body">
                          <label>XML Results ${response}</label>
                    </decorator-section>
                </decorator-screen>
            </widgets>
        </section>
    </screen>



And this is the results of my best efforts --->   XML Results
org.apache.catalina.connector.ResponseFacade@1f920cf



Please guide this newbie in the right direction as i seem to have missed the
boat some where.


Kind regards

Grant e