cancel
Showing results for 
Search instead for 
Did you mean: 

Using web service with 'Error starting session' exception

fantastic340
Champ in-the-making
Champ in-the-making
Hi every one,
When I was using web service API in order to create a link for node,
my part of code as follows:


                        CMLCreate create = new CMLCreate();
                        create.setParent(destinationFolder);
                        create.setAssociationType(Constants.ASSOC_CONTAINS);
                        if (isFolder) {
                                //it`s a link of folder type
                                create.setType("{http://www.alfresco.org/model/application/1.0}folderlink");
                        }else{
                                create.setType("{http://www.alfresco.org/model/application/1.0}filelink");
                        }
                        create.setProperty(prop);
                        create.setChildName("Childname");

                        CML cml = new CML();
                        cml.setCreate(new CMLCreate[] { create });

                        WebServiceFactory.setEndpointAddress("http://140.92.25.160:80/alfresco/api");
         AuthenticationUtils.startSession("admin","admin");
                        RepositoryServiceSoapBindingStub repositoryServiceSoapBindingStub =
                                        WebServiceFactory.getRepositoryService();
                        result = repositoryServiceSoapBindingStub.update(cml);
                
                        if(result.length > 0 ){
                                isSuccess = true;
                        }
                        AuthenticationUtils.endSession();

                }


And it will show error as below:


org.alfresco.webservice.util.WebServiceException: Error starting session.
        at org.alfresco.webservice.util.AuthenticationUtils.startSession(AuthenticationUtils.java:88)
        at tw.org.iii.cosa.javabacked.webscript.SoftLinkCreator.wsCreateLink(SoftLinkCreator.java:223)
        at tw.org.iii.cosa.javabacked.webscript.SoftLinkCreator.executeImpl(SoftLinkCreator.java:95)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:64)




Could anyone can help me? thanks in advance.
My alfresco version is 3.4.5 and using alfresco-web-service-client-3.4.5.jar,axis-1.3.jar by the way.
7 REPLIES 7

kaynezhang
World-Class Innovator
World-Class Innovator
Native webservice is deprecated,please use other API .
opencmis API is recommended .

Hi kayne,
thanks for your advice,but could you give me more details or example about using opencmis API in this case?
I would appreciate that.

kaynezhang
World-Class Innovator
World-Class Innovator
I'm sorry I did not see clearly.you are using alfresco version 3.4.5,it is two old .I don't know whether  cmis specification is well supported in that version.
As  the error,have you tried the address
 http://localhost:8080/alfresco/soapapi
?

Native webservice is not recommended in alfresco 4.x and was removed in alfresco 5.x.Please refer to https://wiki.alfresco.com/wiki/Alfresco_Content_Management_Web_Services for more information

fantastic340
Champ in-the-making
Champ in-the-making
I have tried the address http://loacalhost:8080/alfresco/soapapi before,but it got the same error,
so is there any solution to make it work in alfresco version 3.4.5??

fantastic340
Champ in-the-making
Champ in-the-making
Update some info:
When I was using pure alfresco without others application to do same thing, and unexpectedly it`s work fine!
However, when I developed some application which is RESTful application based on alfresco, and then it`s fail.
Therefore is there any idea for my situation?

kaynezhang
World-Class Innovator
World-Class Innovator
Maybe it is caused by jar packages collisions,please check your classpath.

Hi Kayne,
I have checked the jar packages,it did not occur collisions.
it perhaps cause by other reasons.
Thanks for ur tip.