cancel
Showing results for 
Search instead for 
Did you mean: 

Can't embed a Alfresco webscript in a Share custom page

ardamose123
Champ on-the-rise
Champ on-the-rise
I've been trying to include the result of an Alfresco Explorer webscript in a Share custom page, but to no avail.

Basically, what I've done is to create a page (with its corresponding configuration XMLs somewhere else) in an
alfresco/web-extension/templates/results.ftl
:

<blockcode>
<#include "/org/alfresco/include/alfresco-template.ftl" />
<@templateHeader />

<@templateBody>
  <@markup id="alf-hd">
  <div id="alf-hd">
    <@region id="header" scope="global" protected=true />
    <div class="page-title theme-gb-color-1 theme-border-1">
      <h1 class="theme-color-3">Some title</h1>
    </div>
  </div>
  </@>
  <@markup id="bd">
  <div id="bd">
    <div>
      <@region id="custresults" scope="global" />
    </div>
  </div>
  </@>
</@>

<@templateFooter>
  <@markup id="alf-ft">
  <div id="alf-ft">
    <@region id="footer" scope="global" />
  </div>
  </@>
</@>
</blockcode>

The "custresults" region is defined in an
alfresco/web-extension/site-data/components/global.cusresults.xml
file with the following contents.

<blockcode>
<?xml version="1.0" encoding="UTF-8"?>
<component>
  <scope>global</scope> 
  <region-id>custresults</region-id>
  <url>???</url>
  <guid>page.custom.results</guid>
</component>
</blockcode>

My problem is with the URL tag. The webscript is shown if implemented in Share. However, since what I need is in an Alfresco (non-Share) webscript, I want to show that Alfresco webscript and not a Share one. If I actually attempt to use the Alfresco webscript as URL (in all experiments I've run), nothing about the webscript is shown besides the rest of the Freemarker template.

Do you know if there a way to show the results of an Alfresco (non-Share) webscript in a Share custom page?
3 REPLIES 3

ddraper
World-Class Innovator
World-Class Innovator
I think that you're missing the source-id element from your Component definition… because you are defining a globally scoped Component you should be able to just set "source-id" to be "global". Try the following:


<?xml version="1.0" encoding="UTF-8"?>
<component>
  <id>global.custresults</id>
  <scope>global</scope>
  <source-id>global</source-id>
  <region-id>custresults</region-id>
  <url>???</url>
</component>


You still need to put your WebScript URL in the <url> element though - and I have intentionally removed the <guid> element, you shouldn't try to build that yourself. Hopefully that should resolve your problem,

Regards,
Dave

No, that doesn't solve the problem, although those were good pointers.

The webscript URL is something like this:
http://localhost:8080/alfresco/service/com/example/components/search/results
. If I run it as is, it shows some search results.

Since I want to use it in Share, I've used the following URLs for the
<url
tag in the component:
<ul>
<li>
com/example/components/search/results

<li>
/com/example/components/search/results

<li>
alfresco/service/com/example/components/search/results

<li>
/alfresco/service/com/example/components/search/results

<li>
http://localhost:8080/alfresco/service/com/example/components/search/results

</ul>

However, none of these shows the webscript HTML.

rjohnson
Star Contributor
Star Contributor
If I understand your drift here, and you are calling from the Share client your URL should be


http://localhost:9090/share/proxy/alfresco/service/com/example/components/search/results


assuming that you have "told Alfresco in the desc.xml of your webscript that it is at URL


service/com/example/components/search/results


If you are calling from JS in the client, there is an alfresco constant Alfresco.constants.PROXY_URI for the

http://localhost:9090/share/proxy/alfresco/


bit.

If you are in the Share layer, you will have to use a remote connection which is set up like


var con = remote.connect("alfresco");
var response = con.call("/com/example/components/search/results");