I am currently implementing my own persistence layer for Orbeon Forms. As far as I have understood the virtual hierachy of data, creating a form with Form Builder in the application “myapp” with the name “myform” should cause the form builder to call
/crud/myapp/myform/form/form.xhtml, passing the newly created form as HTTP-PUT data. Thus I created a spring method annotated with:
@RequestMapping(method = RequestMethod.PUT, value = "/crud/{applicationName}/{formName}/form/form.xhtml")
public void saveForm(@PathVariable String formName, @RequestBody String putData)
I expected this method to be called with my form. But this method does not get called. Instead the method
@RequestMapping(method = RequestMethod.PUT, value = "/crud/{applicationName}/{formName}/data/{uuid}/data.xml")
public void saveInstance(@PathVariable String uuid, @RequestBody String putData)
gets called. putData contains the full XHTML form. Why is this happening? I thought that the second URL would only be called for saving an instance, more specifically the <xforms:instance id="fr-form-instance"> part of a form, once I fill in values for a form.
The answer is that the form definition can be in two places:
When you edit it with Form Builder, the form definition is just form data as far as the builder is concerned. So it’s stored as
data.xmlfororbeon/builder.When you publish it, it is copied to (HTTP PUT)
form.xhtmlformyapp/myform. It is also read from there (HTTP GET) when the form definition is needed to view/edit/search data associated with that form.You can easily verify this by publishing the form.
The good news is that you need 1 above anyway to handle form data for published forms.
Note that form definitions and form data can both have attachments as well.