cancel
Showing results for 
Search instead for 
Did you mean: 

calling upload webscript using ajax and json callback

harshit_kapoor
Champ in-the-making
Champ in-the-making
Hi All,

I am new to Alfresco.
My requirement is that I need to upload file (from my webclient IE9 HTML4) to Alfresco and get an id back with which it can be accessed later.
I think the above can be achieved by using Upload webscript (POST for data to http://localhost:8080/alfresco/service/api/upload).
This webscript returns Json back. I need to parse this Json and fetch noderef.


I need to do this using AJAX (jquery or XMLHTTPRequest).

I found that webscripts that return Json can use alf_callback to handle the reply.
I created very rudimentary html page to test this out.
In a post I saw that in order to get the alf_callback to work, we need to enable it using custom-web-context.xml.

I am not able to get the custom-web-context.xml configured properly

I tried the following:
<beans>

     <bean id="webscripts.container" class="org.alfresco.repo.web.scripts.TenantRepositoryContainer" parent="baseAlfrescoRepositoryContainer" init-method="setup">
      <property name="name"><value>Repository</value></property>
      <property name="allowCallbacks"><value>true</value></property>
    </bean>
         
</beans>

and the following:
<?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="webscripts.container" parent="webscripts.abstractcontainer" class="org.springframework.extensions.webscripts.PresentationContainer">
      <property name="name"><value>Repository</value></property>
      <property name="allowCallbacks"><value>true</value></property>
    </bean>
         
</beans>

But both did not work.
I am not able to get the custom-web-context.xml configured properly.

Could you please help?

Thanks
Harshit
3 REPLIES 3

sumitsharma
Champ in-the-making
Champ in-the-making
Hello There,

I need to integrate the "webscript" methods with my applcation and i can do that only by using Alfresco's exposed "REST/SOAP" API's. I see many topics on the Alfresco site but did't find a good documentation.

Kindly provide me a link/documentation from where i can easily use the methods exposed REST/SOAP API's and use it in my application.

Thanks,
Sumit Kumar

muralidharand
Star Contributor
Star Contributor
To integrate with third part application, you can CMIS instead of using webscript.

hdalang
Champ in-the-making
Champ in-the-making
I also need to know how to start deploying using webscript. please complete the topic if you find a solution for that.