Expand my Community achievements bar.

http post and Alfresco web script

Avatar

Former Community Member

Hi all,

I'm wondering how to send the content of an XFA form into an Alfresco ECM instance. So far, I've been using "email submit buttons" by mail, but I think submitting the xml content directly into an Alfresco space could be feasible without too much trouble.

I'm trying to adapt the online script fromLiveCycle documentation

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/wwhelp/wwhimpl/common/html/wwhelp....

same in version 9 : http://help.adobe.com/en_US/livecycle/9.0/programLC/help/index.htm?content=001303.html

which are about the same docs as the ones on Alfresco wiki (http://wiki.alfresco.com/wiki/Web_Scripts_Examples#File_Upload) although LiveCycle is only based on Alfresco AFAIK.

I don't want to use an HTML form, but directly send my form from my pdf xfa form. I made a small test using a fixed url on an HttpSubmitButton

http://localhost:8080/alfresco/s/upload?guest=true&fileName=liveCycleDocument&title=myTitle&descript...

On Alfresco, the document is created with the correct args values. But I still don't know how to send the real form content to the URL.


I checked on this document http://partners.adobe.com/public/developer/en/livecycle/lc_understanding_submit_tip.pdf where I discovered I can use a custom submit button to send the datasets, but still cannot get my form xml data.

I hope someone will have a clue about LiveCycle/Alfresco communication.

Thx

Best regards,

jgrd

3 Replies

Avatar

Former Community Member

Hi,

I'm answering to myself.

I've found that a "requestbody" object is available from javascript. This object has a property "content" which contains the xml content of the form.

jgrd

Avatar

Level 10

Can you provide your script how you did it??

Thanks

Srini

Avatar

Former Community Member

@Srini
Yes of course :

in Data Dictionary/Web Scripts (or Web Scripts extensions): create the 3 files

You may use spaces for package/subpackages:

- pdfform.post.desc.xml

     <webscript>
     <shortname>pdf form</shortname>
     <description>processing pdf form</description>
     <url>/pdfform</url>
     <authentication>guest</authentication>
     </webscript>

- pdfform.post.js :
upload = companyhome.createFile("form." + companyhome.children.length + "." + args.fileName) ;
upload.properties.content.content = requestbody.content;
upload.properties.encoding = "UTF-8";
upload.properties.title = args.title;
upload.properties.description = args.description;
upload.save();

model.upload = upload

-pdfform.post.html.ftl (freemarker)

<html>
<head>
   <title>Test pdf form</title>
  </head>
<body>
done !
</body>
</html>

- Register the script by refreshing the page http://localhost:8080/alfresco/s/index

or with curl -X POST "-uadmin:admin" -d "reset=on" http://localhost:8080/alfresco/s/index (as mentioned by Jeff Potts)

- try it with from a pdf

use a plain button, select "Submit", Submit to URL = "http://localhost:8080/alfresco/s/pdfform?guest=true&fileName=myFileName.xml&title=myTitle&description=myDescription", Sumit As = XDP

Test done with Alfresco 3.3CE, LiveCycle 8.2.1/Adobe 9.3

Hope all this will is correct as I'm learning web scripts,

Regards,

jgrd