I am very new to Alfresco and was trying to ascertain if it's possible to create a web form that submits to a different server. The form would exist in Alfresco but we need a different server to process the submitted form, which in this case would be a file upload.
The following assumes you are trying to post to a second Alfresco server from the first one. Yes it is possible to do this. You would need to do the following
- Get a valid authentication to the remote Alfresco server (eg. grab a ticket using the login webscript)
- Wrap you form data into a JSON object
- Post the JSON object to the remote Alfresco server and handle the response appropriately.
On the remote Alfresco server you will need a WebScript or servlet to handle the POST and send the appropriate JSON response.
If you're using alfresco share, here's an idea of how I have a similar problem solved:
First, we have 1 dashlet with the original form. This forms action is another alfresco dashlet. The user puts the desired data here and submits the form. Now, the form, upon submit calls another of our dashlets.
The other dashlet executes a server side script first. It goes something like this:
var url = 'http://something.net/which_isnt_alfresco?parameters
var connector = remote.connect("http");
var result = connector.call(url);
Then the other dashlet gets rendered - you can either inject the response html in the original dashlet, open this new dashlet as a "You're fine" popup window or whatever you need, I suppose.