Bonjour,

J'aimerais récupérer d'Alfresco le ContentResult de mon document.

Je travaille avec JBoss 7.1 et j'utilise ces jar dans mon application :

alfresco-web-service-client-4.0.d.jar,axis-1.4.jar,axis-saaj-1.2.jar,wsdl4j-1.6.2.jar,wss4j-1.5.4-patched.jar,xmlsec-1.4.1.jar

mais lors de test de ce code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
 ContentResult contentResult = AlfrescoClientWS.getContentsById(docid,"HTTP://192.168.8.100:9080/alfresco/api",
                    GedListener.credentialUser, GedListener.credentialPwd);
qui fait appel à cette classe :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import org.alfresco.webservice.content.Content;
import org.alfresco.webservice.content.ContentFault;
import org.alfresco.webservice.content.ContentServiceSoapBindingStub;
import org.alfresco.webservice.repository.QueryResult;
import org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub;
import org.alfresco.webservice.repository.UpdateResult;
import org.alfresco.webservice.types.CML;
import org.alfresco.webservice.types.CMLAddAspect;
import org.alfresco.webservice.types.CMLCreate;
import org.alfresco.webservice.types.ContentFormat;
import org.alfresco.webservice.types.NamedValue;
import org.alfresco.webservice.types.ParentReference;
import org.alfresco.webservice.types.Predicate;
import org.alfresco.webservice.types.Query;
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.Constants;
import org.alfresco.webservice.util.ContentUtils;
import org.alfresco.webservice.util.Utils;
import org.alfresco.webservice.util.WebServiceFactory;
 
import org.apache.commons.io.IOUtils;
 
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
 
import java.rmi.RemoteException;
 
import java.util.ArrayList;
import java.util.List;
 
import javax.activation.MimetypesFileTypeMap;
 
 
public class AlfrescoClientWS {
 
public static ContentResult getContentsById(String contentId, String cmurl, String userName, String pwd)
        throws Exception {
        ContentResult contentResult = new ContentResult();
 
        // Start the session
        WebServiceFactory.setEndpointAddress(cmurl);
        AuthenticationUtils.startSession(userName, pwd);
 
        try {
            Store storeRef = new Store(Constants.WORKSPACE_STORE, "SpacesStore");
            ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
 
            Reference contentReference = new Reference(storeRef, contentId, null);
            Content[] readResult = null;
 
            try {
                readResult = contentService.read(new Predicate(new Reference[] { contentReference }, storeRef, null), Constants.PROP_CONTENT);
            } catch (ContentFault e) {
                e.printStackTrace();
            } catch (RemoteException e) {
                e.printStackTrace();
            }
 
            if ((readResult != null) && (readResult[0] != null)) {
                Content content = readResult[0];
                ContentFormat cnf = content.getFormat();
                Reference ref = content.getNode();
 
                String[] splitedUrl = content.getUrl().split("/");
                String name = splitedUrl[splitedUrl.length - 1];
 
                InputStream is = ContentUtils.getContentAsInputStream(content);
                byte[] contentByte = IOUtils.toByteArray(is);
 
                contentResult.setName(name);
                contentResult.setMimetype(cnf.getMimetype());
                contentResult.setId(ref.getUuid());
                contentResult.setUrl(content.getUrl());
                contentResult.setPath(ref.getPath());
                contentResult.setContentByte(contentByte);
                System.out.println(" document has been retrieved");
            }
        } catch (Exception e) {
            System.out.println(e.toString());
        } finally {
            // End the session
            AuthenticationUtils.endSession();
 
            // System.exit(0);
        }
 
        return contentResult;
    }
 
}
J'ai cette erreur :
17:07:40,546 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/myProject].[FileUploadServlet]] (http-localhost-127.0.0.1-8080-5) "Servlet.service()" pour la servlet FileUploadServlet a généré une exception: java.lang.NoSuchMethodError: org.apache.xml.security.transforms.Transform.init()V
at org.apache.ws.security.WSSConfig.staticInit(WSSConfig.java:244) [wss4j-1.5.4-patched.jar:]
at org.apache.ws.security.WSSConfig.<init>(WSSConfig.java:256) [wss4j-1.5.4-patched.jar:]
at org.apache.ws.security.WSSConfig.getNewInstance(WSSConfig.java:265) [wss4j-1.5.4-patched.jar:]
at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:89) [wss4j-1.5.4-patched.jar:]
at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:170) [wss4j-1.5.4-patched.jar:]
at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32) [axis-1.4.jar:]
at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118) [axis-1.4.jar:]
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83) [axis-1.4.jar:]
at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127) [axis-1.4.jar:]
at org.apache.axis.client.Call.invokeEngine(Call.java:2784) [axis-1.4.jar:]
at org.apache.axis.client.Call.invoke(Call.java:2767) [axis-1.4.jar:]
at org.apache.axis.client.Call.invoke(Call.java:2443) [axis-1.4.jar:]
at org.apache.axis.client.Call.invoke(Call.java:2366) [axis-1.4.jar:]
at org.apache.axis.client.Call.invoke(Call.java:1812) [axis-1.4.jar:]
at org.alfresco.webservice.content.ContentServiceSoapBindingStub.read(ContentServiceSoapBindingStub.java:467) [alfresco-web-service-client-4.0.d.jar:]
at com.dq.urbanplanning.web.ged.AlfrescoClientWS.getContentsById(AlfrescoClientWS.java:162) [classes:]
............
.........
L'erreur est lancée depuis cette ligne :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
readResult = contentService.read(new Predicate(new Reference[] { contentReference }, storeRef, null), Constants.PROP_CONTENT);
Quelqu'un saurait-il m'indiquer d'où peut venir le problème ?

Merci d'avance pour votre aide.