Send action
Introduction
This action sends data to an HTTP URL.
Configuration
Using parameters
[SINCE Orbeon Forms 4.4 except property]
The following example uses three parameters in the send action for the form my_app/my_form:
<property as="xs:string" name="oxf.fr.detail.process.send.my_app.my_form" >
send(
uri = "http://example.org/accept-form",
method = "PUT",
content = "metadata"
)
</property>The following parameters can be used:
property: specifies an optional property prefixuri: URL to which to send the datamethod:GET,POST(default), orPUTnonrelevant[SINCE Orbeon Forms 2017.1]
values
keep: all values are serialized,remove: non-relevant values are not serialisedempty: non-relevant nodes are serialized as empty values
default:
remove
prune[DEPRECATED SINCE Orbeon Forms 2017.1]
use
nonrelevantinsteadwhether to prune non-relevant nodes (
trueby default)
annotate: space-separated list of levels to annotate elements (the empty string by default)replace:allto load the resulting response in the browser, ornone(default)[SINCE Orbeon Forms 4.5]
If
replaceis set toalland the service issues a redirection via an HTTP status code, the redirection is propagated to the client. This also works with portlets.SECURITY NOTE: If
replaceis set toall, the content of resources or redirection URLs accessible by the Orbeon Forms server are forwarded to the web browser. Care must be taken to forward only resources that users of the application are allowed to see.content:xmlto send the XML data (default)metadatato send form metadata, see details [SINCE Orbeon Forms 4.7]pdfto send the PDF binary, see details [SINCE Orbeon Forms 2016.2]tiffto send the TIFF binary, see details [SINCE Orbeon Forms 2016.2]pdf-urlto send the PDF URL, see detailstiff-urlto send the TIFF URL, see details [SINCE Orbeon Forms 2016.1]
data-format-version[SINCE Orbeon Forms 4.8]:edge: send the data in the latest internal format4.0.0: send the data in the Orbeon Forms 4.0-compatible format (the default)
parameters: name of parameters sent to the service end point, in addition to theform content
space-separated list of standard parameters to automatically add to the URL (see below)
default:
app form form-version document valid language process data-format-versionform-versionadded to defaults in Orbeon Forms 4.7processadded to defaults in Orbeon Forms 4.7
serialization:[SINCE Orbeon Forms 4.7]
determine the serialization of the XML data
values
application/xml: XML serializationnone: no serialization
default
application/xmlwhenmethodis set topostorputnoneotherwise
prune-metadata:[SINCE Orbeon Forms 2016.1]
this is applied when
contentis set toxmlonlytrueto remove all occurrences offr:-prefixed elements and attributesfalseto leave such occurrencesdefault
falsewhendata-format-versionis set toedgetrueotherwise
content-type:[SINCE Orbeon Forms 2016.2]
specify the
Content-Typeheader to set whenmethodis set topostorputit is usually not necessary to specify
content-typeexplicitlydefault
application/xmlwhencontentis set toxml,metadata,pdf-urlortiff-urlapplication/pdfwhencontentis set topdfimage/tiffwhencontentis set totiff
show-progress:[SINCE Orbeon Forms 2017.1]
if
replaceis set toall, whether to continue showing the loading the indicator while the browser navigates away from the current pagetypically, you'll only want to set this parameter to
falseif you know that URL the browser navigates to won't replace the current page, say because the page will be opened in another window, or be downloaded by the browserdefault:
true
target:[SINCE Orbeon Forms 2017.1]
if
replaceis set toall, specifies the name of the window where to display the result from thesend(), with same semantic as the HTMLtargetattribute on<a>typically, if setting a
target, you'll also want to add areplace = "false"attribute, so the loading indicator on the current page doesn't stay after the content in the target page has been loadeddefault: none
Using properties
The following example refers in the send action to the properties with the common prefix oxf.fr.detail.process.send.my_app.my_form. It configures the URL, the method, and the type of content using three additional sub-properties.
The following properties can be used to configure a send action with properties:
property prefix +
.uri: seeuriparameterproperty prefix +
.method: seemethodparameterproperty prefix +
.nonrelevant: seepruneparameterproperty prefix +
.prune: seepruneparameterproperty prefix +
.annotate: seeannotateparameterproperty prefix +
.replace: seereplaceparameterproperty prefix +
.content: seecontentparameterproperty prefix +
.parameters: seeparametersparameterproperty prefix +
.serialization: seeserializationparameterproperty prefix +
.prune-metadata: seeprune-metadataparameter
Properties and XPath Value Templates
[SINCE Orbeon Forms 4.4]
The following properties are XPath Value Templates evaluating in the context of the root element of the form data instance:
urimethodpruneannotatecontentparametersreplace[SINCE Orbeon Forms 4.7]
Example
Note the use of the encode-for-uri() function which escapes the value to place after the = sign.
Precedence of parameters over properties
Parameters have a higher precedence. In this example, the uri parameter is used, even if a oxf.fr.detail.send.success.uri property is present:
URL format
The full URL is composed of:
the URL specified by the
uripropertythe following URL parameters (when present in
parameters)app: the current form's app nameform: the current form's form nameform-version: the form definition version in use [SINCE Orbeon Forms 4.5]document: the current document idvalid: whether the data sent satisfies validation ruleslanguage: the language of the form at the time it was submitted [SINCE Orbeon Forms 4.5]noscript: whether the noscript mode was in use [SINCE Orbeon Forms 4.6]process: unique process id for the currently running process [SINCE Orbeon Forms 4.7]
Example:
Sending PDF and TIFF content
Controlling the format
[SINCE Orbeon Forms 2018.1]
When using PDF templates and content = "pdf" or content = "tiff", you can control the PDF processing with the following:
use-pdf-templatedefault:
trueIf at least one PDF template is available, the default is to use one of the PDF templates. But if
use-pdf-template = "false", then use of any PDF template is disabled and the automatic PDF is produced.
pdf-template-nameIf
pdf-template-namespecifies a name, such as withpdf-template-name = "archive", the list of available PDFtemplates is reduced to those having an exactly matching name. If no matching name is found, an error is raised.
pdf-template-langIf
pdf-template-langspecifies a language, such as withpdf-template-lang = "fr", the list of availablePDF templates as reduced by
pdf-template-nameis used to find a PDF template with a matching language.If no matching language is found, an error is raised.
If
pdf-template-langis empty or missing:The PDF template with the current form language is used, if there is a match.
If there is no match, the first available PDF template is used.
Sending a PDF binary
[SINCE Orbeon Forms 2016.2]
When content = "pdf" is specified, the PDF binary is sent with a Content-Type set to application/pdf.
Sending a TIFF binary
[SINCE Orbeon Forms 2016.2]
When content = "tiff" is specified, the TIFF binary is sent with a Content-Type set to image/tiff.
Sending a PDF URL
When content = "pdf-url" is specified, the XML document sent has the following format:
The PDF can be retrieved by accessing that path with the proper session cookie.
A use case for this is to submit the URL to a local confirmation page. The page can then link to the URL provided, and the user can download the PDF.
NOTE: When the PDF must be sent to a remote service, it is better to send the PDF binary directly using content = "pdf" .
Sending a TIFF URL
[SINCE Orbeon Forms 2016.1]
When content = "tiff-url" is specified, the XML document sent has the following format:
The TIFF can be retrieved by accessing that path with the proper session cookie.
A use case for this is to submit the URL to a local confirmation page. The page can then link to the URL provided, and the user can download the TIFF file.
NOTE: When the TIFF must be sent to a remote service, it is better to send the TIFF binary directly using tiff.
Sending form metadata
[SINCE Orbeon Forms 4.7]
When content = "metadata" is specified, the XML document sent contains metadata per control. This page shows examples based on the Orbeon Forms sample forms.
NOTE: The <value> element is present only since Orbeon Forms 4.7.1.
The metadata is linked to the data with the for attribute, which can contain multiple id values separated by a space. This associates the given piece of metadata with multiple values in the form data. This typically happens where there are repeated fields in the form, so that there is no duplication of identical metadata.
Here is an example of send process which sends XML data to a service, followed by sending metadata:
Annotating XML data
annotate can contain the following tokens:
error,warning,info: XML elements are annotated with information associated with the given level or levels.id: XML elements are annotated with a unique id. [SINCE Orbeon Forms 4.7]
If the property is missing or empty, no annotation takes place. For example:
Last updated