Rationale
Starting February 2010 builds, Orbeon Forms supports true asynchronous submissions (with some limitations due to the client-server architecture of Orbeon Forms).
Declaring an asynchronous submissionYou enable an asynchronous submission with
mode="asynchronous":<xforms:submission id="call-service" mode="asynchronous" method="get" resource="http://www.orbeon.com/ops/xforms-sandbox/service/zip-states" serialization="none" xxforms:cache="true" replace="instance" targetref="instance('zip-states')"/>This is useful for example to speed up the initial load of data from slow services when the page initializes because the background submissions can run in parallel, and at the same time the page can pursue its own initialization.
NOTE: While XForms 1.1 specifies that
mode="asynchronous" should be the default, in Orbeon Forms mode="synchronous"is the default.The xxforms:join-submission actionAvailabilityThis is an Orbeon Forms PE feature.ConfigurationThis extension action allows waiting until all pending background submissions have completed:
In this example, upon
xforms-model-construct-done, two background submissions are started. The <xxforms:join-submissions> action waits until they both have completed.This has two benefits:
NOTE: If processing background submissions causes new background submissions to run, their results are processed as well.
NOTE: If the resulting instance is cacheable with xxforms:cache="true" and already in cache, it is immediately retrieved and no background submission takes place.
NOTE: Optimized submissions and submissions with
replace="all" are not supported in asynchronous mode.How things workThe submissions are asynchronous in the following way:
The completion of asynchronous submission is checked at these time:
When completed submissions are found, the result of each submission is processed:
If an asynchronous submission is still running (pending) at the time an client HTTP connexion returns (whether an initial page load or an Ajax request):
The polling delay in milliseconds can be configured with the following property:
Earlier implementationAs of July 2009, Orbeon Forms implements a subset of XForms 1.1 asynchronous submissions.
More precisely, Orbeon Forms currently does not allow an asynchronous submission with side-effects (such as replacing an instance, or dispatching events after a response is received) to run after an HTTP response has been sent to the client. This means that either:
Fire-and-forget submissionThis is enabled for a submission with mode="asynchronous" and replace="none", e.g.:
<xforms:submission id="autosave" mode="asynchronous" ref="instance('document')" method="post" Processing
|