cancel
Showing results for 
Search instead for 
Did you mean: 

Web script using javascript

wass
Champ in-the-making
Champ in-the-making
Hello,

i'm having some problems by creating my own web script.

i'm following the wiki tutorial for webscript ( http://wiki.alfresco.com/wiki/Web_Scripts ).
i've build this Controller(testando.get.js):
if(config.global.server!=null){
   model.x = config.script.global.server.children.size;
}
else{
   model.x = 1;
}
model.toWho = (args.to != null) ? args.to : person.properties.userName;
var s = new XML(config.script["testando"]);
model.fromWho = person.properties[s.fromproperty];
with this config file(testando.get.config.xml):
if(config.global.server!=null){
   model.x = config.script.global.server.children.size;
}
else{
   model.x = 1;
}
model.toWho = (args.to != null) ? args.to : person.properties.userName;
var s = new XML(config.script["testando"]);
model.fromWho = person.properties[s.fromproperty];
and i'm getting this error:
500 Description:    An error inside the HTTP server which prevented it from fulfilling the request.

Message:   09240029 Wrapped Exception (with status template): 09240254 Failed to execute script 'classpath*:alfresco/templates/webscripts/teste/testando.get.js': 09240253 str parameter is mandatory

Exception:   java.lang.IllegalArgumentException - str parameter is mandatory

Anyone can help me here?
thank you very much.
3 REPLIES 3

jordiv
Champ on-the-rise
Champ on-the-rise
Hi,

Take a look at Web Scripts Examples, it may help you.
You can also take a look in Alfresco repository in: Data Dictionary > Web Scripts > org > alfresco > sample


Cheers,
Jordi.

wass
Champ in-the-making
Champ in-the-making
thanks and regards.

scouil
Star Contributor
Star Contributor
You pasted you  .js  twice instead of the   .xml.
The error is probably in it… Do you have something like this:
<url>/testando?str={something}</url>