how to create and register webscript

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2007 05:12 PM
hi,
i am trying to create a web script in folder
/Company Home/Data Dictionary/Web Scripts/org/alfresco/sample
and my
swsearch.get.desc.xml
<webscript>
<shortname>sw Search</shortname>
<description> search term</description>
<url>/sw/swsearch</url>
<format default="html">extension</format>
<authentication>guest</authentication>
<transaction>required</transaction>
</webscript>
swsearch.get.html.ftl
<html>
<body>
<img src="${url.context}/images/logo/AlfrescoLogo32.png" alt="Alfresco" />
Blog query: ${args.q}
<br>
<table>
<#list resultset as node>
<tr>
<td><img src="${url.context}${node.icon16}"/>
<td><a href="${url.serviceContext}/api/node/content/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/${node.name?url}">${node.name}</a>
</tr>
</#list>
</table>
</body>
</html>
swsearch.get.js
// check that search term has been provided
if (args.q == undefined || args.q.length == 0)
{
status.code = 400;
status.message = "Search term has not been provided.";
status.redirect = true;
}
else
{
// perform search
var nodes = search.luceneSearch( "(TYPE:\"{http://www.mydomain.com/model/pariksha/1.0}quiz\") AND (@pk\\:tags:\""+args.q +"\")");
model.resultset = nodes;
}
i dont know what i amdoing wron but when i try http://localhost:8080/alfresco/service/sw/swsearch
i am getting Script url /sw/swsearch does not map to a Web Script.
thanks prasanth
i am trying to create a web script in folder
/Company Home/Data Dictionary/Web Scripts/org/alfresco/sample
and my
swsearch.get.desc.xml
<webscript>
<shortname>sw Search</shortname>
<description> search term</description>
<url>/sw/swsearch</url>
<format default="html">extension</format>
<authentication>guest</authentication>
<transaction>required</transaction>
</webscript>
swsearch.get.html.ftl
<html>
<body>
<img src="${url.context}/images/logo/AlfrescoLogo32.png" alt="Alfresco" />
Blog query: ${args.q}
<br>
<table>
<#list resultset as node>
<tr>
<td><img src="${url.context}${node.icon16}"/>
<td><a href="${url.serviceContext}/api/node/content/${node.nodeRef.storeRef.protocol}/${node.nodeRef.storeRef.identifier}/${node.nodeRef.id}/${node.name?url}">${node.name}</a>
</tr>
</#list>
</table>
</body>
</html>
swsearch.get.js
// check that search term has been provided
if (args.q == undefined || args.q.length == 0)
{
status.code = 400;
status.message = "Search term has not been provided.";
status.redirect = true;
}
else
{
// perform search
var nodes = search.luceneSearch( "(TYPE:\"{http://www.mydomain.com/model/pariksha/1.0}quiz\") AND (@pk\\:tags:\""+args.q +"\")");
model.resultset = nodes;
}
i dont know what i amdoing wron but when i try http://localhost:8080/alfresco/service/sw/swsearch
i am getting Script url /sw/swsearch does not map to a Web Script.
thanks prasanth
Labels:
- Labels:
-
Archive
3 REPLIES 3

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 12:17 AM
it turns out i just need to restrat the server.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2007 06:26 PM
You don't have to restart the server.
Go to the URL:
Also, a tip for dumping the contents of your web script to the forum. There's the URL /alfresco/service/script/{scriptid} which will dump everything about your web script, including the implementation files. This can be paste to the forum.
e.g.
Go to the URL:
/alfresco/service/
and hit the "Refresh list of Web Scripts" button. Your webscript will be registered.Also, a tip for dumping the contents of your web script to the forum. There's the URL /alfresco/service/script/{scriptid} which will dump everything about your web script, including the implementation files. This can be paste to the forum.
e.g.
/alfresco/service/org/alfresco/sample/swsearch.get

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-21-2007 01:45 PM
thanks david.
