XFA Specification
Chapter 11, Forms That Initiate Interactions with Servers
Using Web Services
329
Server-side actions initiated by above
The server XFA processing application performs the following steps after it finishes building the form
DOM:
Caution:
For security reasons, the server should discard any template submitted in the XDP package and
obtain a fresh copy of the template from a trusted source.
1. Execute the scripts in the indicated event.
2. Package the data and include it in the HTTP POST return.
Client Submit Event That Conditionally Processes Data at the Server
An event having a script with
runAt="both"
would not normally be submitted to a server even if the
event contains a
submit
element. However, that rule may be overcome by using ECMAScript to invoke
the submission, as shown in the following example.
Example of an event that uses the runAt="both" attribute
The bold text in following example illustrates how the
runAt="both"
attribute can be used.
<field name="pagedown" …>
…
<event name="pagedown" activity="click">
<script runAt="both" contentType="application/x-ecmascript">
system==xfa.host.pageDown();
onerror = xfa.form.root..pagedown.submit();
</script>
<submit
format="xdp"
target="http://www.example.org"
textEncoding="UTF-16"
xdpContent="datasets"/>
</event>
</field>
A template that contained the above example would elicit different results, depending on the capabilities
of the application processing it, as described below:
●
Acrobat with XFA plug-in. This XFA processing application implements the
pageDown()
method. As a
result, if the user clicks on the field named
pagedown
, the script command to page down is successful.
XFA HTML client. This XFA processing application does not implement the
pageDown()
method. As a
result, if the user clicks on the field named
pagedown
, ECMAScript detects an error event (
onerror
). The
ECMAScript error event invokes the
submit
element, which causes the XFA HTML client to send the script
to the server for execution and then to merge the returned result.
Using Web Services
Web services provide a flexible communication interface between many different systems, allowing clients
to submit data to and request data from servers, databases, custom systems, vendors exposing Web
Services, and others. XFA allows fields to connect to web services and thus access any of these facilities.