cancel
Showing results for 
Search instead for 
Did you mean: 

Authentication

irene
Champ in-the-making
Champ in-the-making
I am completly new to this area but hope someone can help. 

I have to use a webservice to submit and retrieve documents out of a repository.  I am trying to use the RepositoryService but I get an error back and all it says is "no ticket"

From what I have googled this means I have to logon to get a ticket first, but how do I do that.  I have mylogin Id and password but I dont know what I should be using to perform the logon. 

I have read about authenticationutils in various web pages.  Is that what I need to access, and if so, where is it

Help!!
2 REPLIES 2

romschn
Star Collaborator
Star Collaborator
This is the out-of-the-box webscript to get the authentication ticket for a user.
http://localhost:8080/alfresco/service/api/login?u={username}&pw={password}

You can use it to get the ticket for the user to proceed further.

Hope this helps.

kaynezhang
World-Class Innovator
World-Class Innovator
You can perform the logon and start a session by using AuthenticationUtils ,and then get repository service using WebServiceFactory.
Below is sample code

import org.alfresco.webservice.util.AuthenticationUtils;
import org.alfresco.webservice.util.WebServiceFactory;


WebServiceFactory.setEndpointAddress("http://localhost:8080/alfresco/api/");//soapapi
AuthenticationUtils.startSession("admin", "admin");
WebServiceFactory.getRepositoryService();//get repository servcie,
//you can also get other servcie through this factory class,for example WebServiceFactory.getDictionaryService()