cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot able to call API Webscript in lastest version alfresco

kimryan
Champ in-the-making
Champ in-the-making
I create new page follow link : http://docs.alfresco.com/4.1/tasks/tutorial-share-add-page.html and add a file to call API in file js, but I am trying to run a webscript using the [var connector = remote.connect(”http”)]; but i cannot able to call the webscript it throws the following error: "ReferenceError: "remote" is not defined." as exception.

I added the "remote" entry to the scriptsObjects in the endpoint tag : 
<bean id="webscripts.container" class="org.alfresco.repo.web.scripts.TenantRepositoryContainer" parent="webscripts.abstractcontainer" init-method="setup">
    …
    <entry key="remote" value-ref="webscripts.script.remote" />
</bean>

there is some config webscript-framework-config.xml…bla bla. I think file doesn´t exist in this version

Have you any idea ???????????
3 REPLIES 3

kaynezhang
World-Class Innovator
World-Class Innovator
"Remote" object is defined in org\springframework\extensions\surf\spring-surf-application-context.xml file in package spring-surf-***-SNAPSHOT,It is still available.
So there must be something wrong with your code ,please paste it here .

rjohnson
Star Contributor
Star Contributor
The remote object is available in all contexts. Now I am not certain about my context names but there is Share and Alfresco and remote is not available in Share (I think).

I do however know from experience where it is an isn't available and can describe the contexts

If you are creating a dashlet then in the dashlet javascript code that is run when the page is created the remote object is available. If you are ajax back to a webscript to get data from a dashlet once it has been displayed in a browser the remote object is not available, nor is it available in rules.

If anyone reading this can straighten me out my context names, I would appreciate it.

kaynezhang
World-Class Innovator
World-Class Innovator

Remember "remote" object is <strong> server-side object ,not client side </strong>
By default it is only available in share but not repository,but by configuring webscripts.container bean in spring we also can enable remote endpoint in repository