XForms/Adder

Motivation
This program demonstrates several different ways to call a web service from a sample XForms application. The example uses both HTTP POST and HTTP GET methods and shows how the results are returned into an instance in the model and how the page can be replaced with the results. The web service it calls is a simple web service that adds two numbers together.

Link to XForms Application
For the results to be put in the model using FireFox, make sure to add  and   to your XForms white list using the Tools/Options/Security/Allowed Sites menu of FireFox. This is required since our web forms are hosted at one domain but the web services are hosted on another domain.

Load XForms Application

Sample Program
                <xf:toggle case="case-submit-done" ev:event="xforms-submit-done"/> </xf:submission> <xf:submission id="post-replace" method="post" action="http://www.cems.uwe.ac.uk/xmldb/rest/db/Wiki/adder-post.xq"> <xf:toggle case="case-busy" ev:event="xforms-submit"/> <xf:toggle case="case-submit-error" ev:event="xforms-submit-error"/> <xf:toggle case="case-submit-done" ev:event="xforms-submit-done"/> </xf:submission> <xf:submission id="get-test" method="get" replace="all" separator="&amp;" action="http://xformstest.org/cgi-bin/showinstance.sh"/> <xf:submission id="post-test" method="post" replace="all" action="http://xformstest.org/cgi-bin/showinstance.sh"/> </xf:model> Using XForms to test XQuery Note, you must have xforms-examples.googlecode.com and www.cems.uwe.ac.uk in your whitelist for this demo to work. <xf:input ref="arg1" incremental="true"> <xf:label>Arg1:</xf:label> </xf:input> <xf:input ref="arg2" incremental="true"> <xf:label>Arg2:</xf:label> </xf:input> <xf:output ref="instance('submit-results')/sum"> <xf:label>Sum:</xf:label> </xf:output> <xf:submit submission="get-instance"> <xf:label>HTTP GET -> instance</xf:label> </xf:submit> <xf:submit submission="post-instance"> <xf:label>HTTP POST -> instance</xf:label> </xf:submit> <xf:submit submission="get-replace"> <xf:label>HTTP GET -> replace</xf:label> </xf:submit> <xf:submit submission="post-replace"> <xf:label>HTTP POST -> replace</xf:label> </xf:submit> <xf:submit submission="get-test"> <xf:label>HTTP Get Test</xf:label> </xf:submit> <xf:submit submission="post-test"> <xf:label>HTTP Post Test</xf:label> </xf:submit> <xf:switch> <xf:case id="ready"/> <xf:case id="case-busy"> Waiting for results from server...            </xf:case> <xf:case id="case-submit-error"> Submit error </xf:case> <xf:case id="case-submit-done"> Submit done </xf:case> </xf:switch>