tags:

views:

23

answers:

2

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.

A: 

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

  1. Get a valid authentication to the remote Alfresco server (eg. grab a ticket using the login webscript)
  2. Wrap you form data into a JSON object
  3. 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.

Jamen
In this case we wanted to have to post to a server that isn't running Alfresco, so Alfresco would be generating the form but the other server would be processing it.
Mathew Attlee
Hmm browser cross domain issues.You could use JQuery and then utilise a JSON callback. Otherwise you may have to build a proxy on your servers to handle this. In a similar problem with two Alfresco servers that's what we did - build simple proxy pages that handled the problems by passing the data we needed to pass back and forward by URL params.
Jamen
A: 

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.

zladuric