cancel
Showing results for 
Search instead for 
Did you mean: 

Java backed webscript in Share

dmartinc
Champ in-the-making
Champ in-the-making
I have a java backed webscript deployed in Alfresco and it works ok (it is successfully used by Share dashlets). I would now like to deploy it in Alfresco Share.

The reason to do that is that I need to call some java code to make CAS SSO with third application from Share, so REST (javascript) + Alfresco java webscript combination is no more usable (I need to have session information from Share in webscript).

As far as I have found out until now, the problem is that the webscript configuration file is in the wrong location, so I would appreciate help with it or the working example with file locations so I could make it work on my system.

The system is:
JBOSS 4.3 + Alfresco 3.4 + Alfresco Share 3.4.0b

The web beans configuration file custom-slingshot-application-context.xml is placed in JBOSS_ROOT\server\default\conf\alfresco\web-extension contains:
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN' 'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="webscript.org.alfresco.test.intaliobridge.get" parent="webscript" class="org.alfresco.module.test.IntalioBridge" />
</beans>

The webscript description file intaliobridge.get.desc.xml is placed in JBOSS_ROOT\server\default\deploy\deploy.last\share.war\WEB-INF\classes\webscripts\org\springframework\extensions\webscripts  and it contains:
<webscript>
  <shortname>Intalio bridge</shortname>
  <description>Return intalio data</description>
  <url>/intaliobridge</url>
  <format default="json">any</format>
</webscript>

Jar file "intaliobridge.jar" is placed in folder JBOSS_ROOT\server\default\deploy\deploy.last\share.war\WEB-INF\lib and the package and class name of the webscript are:

package org.alfresco.module.test;
public class IntalioBridge extends AbstractWebScript {
}

When I access the web script it says "File not found" in browser but the script is successfully registered and displayed in the webscripts list https://localhost:8443/share/page/index/all.

The error (JBOS output) is:

16:10:34,044 ERROR [AbstractRuntime] Exception from executeScript - redirecting to status template error: 02230010 Cannot locate template processor for template
org/springframework/extensions/webscripts/intaliobridge.get.json
org.springframework.extensions.webscripts.WebScriptException: 02230010 Cannot locate template processor for template org/springframework/extensions/webscripts/i
ntaliobridge.get.json
        at org.springframework.extensions.webscripts.AbstractWebScript.renderTemplate(AbstractWebScript.java:587)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.renderFormatTemplate(DeclarativeWebScript.java:267)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:147)
        at org.springframework.extensions.webscripts.PresentationContainer.executeScript(PresentationContainer.java:69)
        at org.springframework.extensions.webscripts.LocalWebScriptRuntimeContainer.executeScript(LocalWebScriptRuntimeContainer.java:203)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:333)
        at org.springframework.extensions.webscripts.AbstractRuntime.executeScript(AbstractRuntime.java:189)
        at org.springframework.extensions.webscripts.servlet.mvc.WebScriptView.renderMergedOutputModel(WebScriptView.java:99)
        at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
        at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1060)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:798)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:716)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:647)
        at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:552)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.alfresco.web.site.servlet.MTAuthenticationFilter.doFilter(MTAuthenticationFilter.java:74)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at hr.abit.ecm.alfresco.CasAuthenticationFilter.doFilter(Unknown Source)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jasig.cas.client.authentication.AuthenticationFilter.doFilter(AuthenticationFilter.java:111)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jasig.cas.client.validation.AbstractTicketValidationFilter.doFilter(AbstractTicketValidationFilter.java:167)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
        at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
        at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
        at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
        at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
        at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
        at java.lang.Thread.run(Thread.java:619)

The most similar problem on internet, that I have found, is in this link http://forum.springsource.org/showthread.php?t=93411. According to that, problem is that webscript description file is on the wrong path and SURF doesn't know how to find the java class to display the output.

I have tried to place the webscript description file in various places (folders under WEB-INF) but none of it worked.
3 REPLIES 3

isloat
Champ in-the-making
Champ in-the-making
How and Where do you call the webscript?
And how do you manage the response?

dmartinc
Champ in-the-making
Champ in-the-making
Hi,

I call webscript with web browser or through XHR request from Javascript. The url is "https://localhost:8443/share/service/intaliobridge.json". The same way I call the webscript that is deployed on alfresco and it works ok - url is "https://localhost:8443/alfresco/script/intalibridge.json"

As I said before, the script is successfully mapped in share scripts list and it links to the webscripts endpoint - it is defined as "https://localhost:8443/share/service/intaliobridge.json". Problem is that accessing the link, error happens (the one previously described).

iseyfi
Champ in-the-making
Champ in-the-making
I am trying to achieve something very similar with Share and CAS. Looking at the spring-webscripts-application-context.xml file in the spring-webscripts-1.0.0.CI-SNAPSHOT.jar file in Share, you will see the search paths for the webscripts.

They should be under alfresco/webscripts or webscripts.

Ismail.