Friday, April 4, 2014

Configure the URL of your services in properties


A few weeks ago, we've seen how you can store Orbeon Forms configurations, in particular the properties-local.xml, outside of the Orbeon Forms war file. We've seen how this allows you to have a single war you deploy on all your environments, and keep differences in configurations between these environments outside of the war file.

This is all good for the Orbeon Forms configurations. Here we'll see that you can use the same mechanism to define custom properties to specify which on what server your services run, or to what server you want data to be posted on submission.

The xxf:property() XPath function

Say you have forms you created with Form Builder, those forms use services, and in the service URL you want a different host name depending on the environment you're in. But of course, you don't want to change the forms as you run them on different environments. You can do this by defining a property, say:
<property as="xs:string"  
Then, in Form Builder, in the HTTP Service Editor dialog, you refer to the value of the property with:

Submission server

When users submit a form, you can setup Orbeon Forms to POST the data captured by the form to one of your servers. You do this with the send action, e.g.:
send(uri = "")
However, if you'd like, you can also move the server URL to its own property:
<property as="xs:anyURI"
And refer to that property in the send action (note that there is .uri at the end of the value passed to send, as the parameter to send is only a prefix, to which send can add different suffixes; for more on this, see the send action):
send(property = "com.example.send")

No comments:

Post a Comment