cancel
Showing results for 
Search instead for 
Did you mean: 

New java webscripts on Alfresco 5.0.2

spilby
Confirmed Champ
Confirmed Champ
Good afternoon,

with Alfresco 4.1.6 we had some java backed webscripts installed with these archives and paths:

1. my_webscript.post.desc.xml on /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/XXX/ path


<webscript>
  <shortname>…</shortname>
  <description>…</description>
  <url>/XXX/my_webscript</url>
  <authentication>user</authentication>
  <format default="json">argument</format>
  <family>Alfresco Java-Backed WebScripts</family>
</webscript>


2. Java webscript classes on /tomcat/webapps/alfresco/WEB-INF/classes

3. And web-scripts-application-context.xml modified on /tomcat/webapps/alfresco/WEB-INF/classes/alfresco/org

with something like this:


    <bean id="webscript.org.alfresco.XXX.my_webscript.post" class="org.My_WebScript" parent="webscript">
     <property name="serviceRegistry" ref="ServiceRegistry"/>
     <property name="customProperties">
        <ref bean="global-properties"/>
     </property>
     <property name="alfrescoService" ref="alfrescoService"/>
  </bean>


It worked ok, and now we try to migrate this webscripts on Alfresco 5.0.2 version, changing the placement to the new paths. But don't works.

We are doing this:

1. my_webscript.post.desc.xml on /tomcat/shared/classes/alfresco/extension/templates/webscripts/org/alfresco/XXX/ path

2. Java webscript classes on /tomcat/webapps/alfresco/WEB-INF/classes/org/alfresco (the same that 4.1.6 version)

Until here all is ok?

And finally, the web-scripts-application-context.xml archive. It still exists on Alfresco 5.0?

First I put it on /tomcat/webapps/alfresco/WEB-INF/ but don't works. Then I read about the javadir-context.xml. In our case, my_webscript-context.xml, and I put this archive on /tomcat/shared/classes/alfresco/extension with this code:


<beans>
  <bean id="webscript.org.my_webscript-context.post"
    class="org.My_WebScript" parent="webscript">
  <property name="repository" ref="repositoryHelper"/>
  </bean>
</beans>


But no works, when I try to acces with the url http://IP/alfresco/service/XXX/my_webscript gives me a 404 Not Found.

Is the url ok? Someone can see an error on my configuration files? I can't find it Smiley Surprised\

Thanks!

Best regards
5 REPLIES 5

mrogers
Star Contributor
Star Contributor
Put your descriptor files in  /tomcat/shared/classes/alfresco/templates/webscripts/org/alfresco/XXX

muralidharand
Star Contributor
Star Contributor
It looks like, there is a typo error in the path.

/tomcat/shared/classes/alfresco/<strong>extesion</strong>/templates/webscripts/org/alfresco/XXX
It should be,
/tomcat/shared/classes/alfresco/<strong>extension</strong>/templates/webscripts/org/alfresco/XXX

angelborroy
Community Manager Community Manager
Community Manager
Try using Alfresco SDK for Alfresco 5: http://docs.alfresco.com/5.0/concepts/alfresco-sdk-intro.html

URL depends on XML descriptor. In my opinion, you should include it also on extension folder.

Maybe this http://ecmarchitect.com/alfresco-developer-series-tutorials/webscripts/tutorial/tutorial.html can help with Alfresco SDK and WebScripts.
Hyland Developer Evangelist

Thanks Angel, these link help me a lot with the example explained in it.

The alfresco main paths are all ok, finally was a problem with my part of url path (that I had resumed in my question with XXX). I solve it and all works ok!

I resume it with a simple example (with A and B) if someone have the same problem:

1. Put your example.get.desc.xml, with an url


<url>/B/example</url>


on:

/tomcat/shared/classes/alfresco/extension/templates/webscripts/A/B/

2. Your example-context.xml, with a bean like


<bean id="webscript.A.B.example.get" class="org.ExampleWebscript">…</bean>


on:

/tomcat/shared/classes/alfresco/extension/example-context.xml

on the same place than model.xml

3. Classes on:

/tomcat/webapps/alfresco/WEB-INF/classes/org/

And all works ok if you do it.


One question… If my java webscript needs some own jars, where you usually put it on alfresco? On which path?




angelborroy
Community Manager Community Manager
Community Manager
By using AMP, dependency JARS are managed by deployment tool (which is very convenient).

If you want to use plain file dropping, you can use
/tomcat/webapps/alfresco/WEB-INF/lib
and
/tomcat/webapps/share/WEB-INF/lib
Hyland Developer Evangelist