AnsweredAssumed Answered

Webservice show the url the documents of a space

Question asked by berenicestr69 on Aug 9, 2010
Latest reply on Sep 28, 2010 by berenicestr69
Hello, i´m trying to do a webservice.

When its called, send for paremeter the space folder to serarch the documents.

If there is documents, show the url to download it.

¿how can I do it??? Please  I need Help.


This is the code of my WebService:

package org.alfresco.documentos.webservice;

import java.rmi.RemoteException;

import org.alfresco.webservice.authentication.AuthenticationFault;
import org.alfresco.webservice.repository.QueryResult;
import org.alfresco.webservice.repository.RepositoryFault;
import org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub;
import org.alfresco.webservice.types.Reference;
import org.alfresco.webservice.types.ResultSet;
import org.alfresco.webservice.types.ResultSetRow;
import org.alfresco.webservice.types.Store;
import org.alfresco.webservice.util.AuthenticationUtils;
import org.alfresco.webservice.util.WebServiceFactory;

public class ObtenerDocumentos {
     private static String URL_SERVER  = "http://localhost:8080/Alfresco/api"; 
   
     /** Estaclece la url al servidor de Alfresco
     * @param AlfrescoServerUrl */
      
         private static  void setServerUrl(String AlfrescoServerUrl) { 
             WebServiceFactory.setEndpointAddress(AlfrescoServerUrl); 
         } 
         private static void obtenerWSDocumentos(Store store, String myUuid)
         {
            setServerUrl(URL_SERVER);
               try {
               try {
                  AuthenticationUtils.startSession("admin", "admin");
               } catch (AuthenticationFault e1) {
                  // TODO Auto-generated catch block
                  e1.printStackTrace();
               }
                 Reference myFolder = new Reference(store, myUuid, null); // You can specify the path instead of the uuid if you prefer
                  RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
                  QueryResult queryResult = null;
               try {
                  queryResult = repositoryService.queryChildren(myFolder);
               } catch (RepositoryFault e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               } catch (RemoteException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
               }
                  ResultSet resultSet = queryResult.getResultSet();

                  ResultSetRow[] rows = resultSet.getRows();
                  for(ResultSetRow row : rows) {
                     // Every "row" is pointing to a file
                     // Whow can I get the url????   PLEASE HELP
  
                  }
            } 
               finally 
                { 
                    // Finalizamos la sesión 
                    AuthenticationUtils.endSession(); 
         
                }    

         }
   
   }

Outcomes