AnsweredAssumed Answered

use of alfresco/wcservice instead of alfresco/service

Question asked by gguner on Dec 10, 2007
Latest reply on Dec 10, 2007 by davidc
i'm trying to create a new file under the company home space. I want this to be done with admin authentication but it's not important this to be admin, it can be a user, too. But i faced with a problem:

Web Script Status 405 - Method Not Allowed
Message:   Script url /alfresco/wcservice/sample/create does not support the method GET
 
Exception:   org.alfresco.web.scripts.WebScriptException - Script url /alfresco/wcservice/sample/create does not support the method GET

I used alfresco/service but when i read some posts of other developers about this topic, i see i should use alfresco/wcservice. i read the wiki page:

http://wiki.alfresco.com/wiki/Web_Script_Runtimes#Servlet_Runtime_.28HTTP_Access.29

but sadly i couldn't understand the use of alfresco/wcservice.
how can i use authentication and make this script to work properly?
and should i have alfresco enterprise to do this task( creating a file)?

create.post.desc.xml=>
<webscript>
   <shortname>Create</shortname>
   <description>Creates a file</description>
   <url>/alfresco/wcservice/sample/create?name={newfile}</url>
   <authentication>admin</authentication>
   <transaction>required</transaction>
</webscript>

create.post.js=>
var fname=args.name;
var myFile=companyhome.createFile(fname);
myFile.properties.title=fname+".txt";
myFile.properties.description="my new file";
myFile.save();

Outcomes