cancel
Showing results for 
Search instead for 
Did you mean: 

use of alfresco/wcservice instead of alfresco/service

gguner
Champ in-the-making
Champ in-the-making
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();
3 REPLIES 3

davidc
Star Contributor
Star Contributor
Exception:   org.alfresco.web.scripts.WebScriptException - Script url /alfresco/wcservice/sample/create does not support the method GET

Your web script is configured to handle POST, not GET i.e. you have the following file names…

create.post.desc.xml
create.post.js

And you're making a GET request to your URL /alfresco/wcservice/sample/create?name={newfile}

The error is not related to authentication.

gguner
Champ in-the-making
Champ in-the-making
thank you for reply.

when i made the url:
URL /alfresco/wcservice/sample/create

and just want to create a dumb file in company home, it is still giving same error. what is the difference between GET and POST methods url arguments.

davidc
Star Contributor
Star Contributor
HTTP GET & POST.
Getting started

Tags


Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.