cancel
Showing results for 
Search instead for 
Did you mean: 

Urgent:How to validate ticket using Alfresco Web Service API

itsard
Champ in-the-making
Champ in-the-making
Hi,
How do I validate ticket using Alfresco Web Service APIs.I can get a ticket after authenticating the user but how do I pass that ticket
to the subsequent api calls as those apis dont have ticket parameter as an argument.
The Rivet apis that I have checked have the ticket parameter as an argument. Is that an advantage of the Rivet api
over the web service api.
24 REPLIES 24

cheffilet
Champ in-the-making
Champ in-the-making
Now what happens is that a call is made to upload and the authentication works…when i again give the web service call, it says no ticket found.
Then after trying for 3-4 hits, it again finds the ticket in the call without even using startsession() again.

Well this says to me that something gona strange between some requests. I guess you´re using HTTPRequests to Server X where this server requests Alfresco via WS, right? So how gets the authenticationDetails (where ticket will be stored) saved during multiple HTTPRequests on this server? Because if you do a new Request to your Server, you probably dont posses a ticket as the AuthenticationUtils.startSession-method binds the authenticationDetails on the local Thread - a servlet-Thread. So, if you dont release your object from the thread its still there to use by another request as ServletThreads didnt recycled but reused. So for each Request you take on the server, at first you have to store the AuthenticationDetails upon the current thread: AuthenticationUtil.setAuthenticationDetails. So if you login to alfresco at the first time and you receive the AuthenticationDetails, store this object in the session to retrieve it on your Http-Server.

itsard
Champ in-the-making
Champ in-the-making
So if you login to alfresco at the first time and you receive the AuthenticationDetails, store this object in the session to retrieve it on your Http-Server.

I found out following api methods.

        ContentServiceSoapBindingStub contentService = WebServiceFactory.getContentService();
        contentService.setMaintainSession(true);
        contentService.SESSION_MAINTAIN_PROPERTY
contentService.setHeader(String,String,Object)
contentService.setHeader(SOAPHeaderElement);

1. Can you please guide me whether these api methods will help me to maintain session with alfresco server from my web server?

2. Is there some way to retriev the SOAPHeaderElement object that is created by Alfresco while authentication

Thanks again for your reply

cheffilet
Champ in-the-making
Champ in-the-making

HttpSession session …

AutheneticationDetails details = null;

if((details  = session.get(AutheneticationDetails.class.getSimpleName())) == null) {
   details = AuthenticationUtils.startSession(lStrLoginName,lStrPassword);
   session.put(AutheneticationDetails.class.getSimpleName(), details);
}
else
  AuthenticationUtils.setAuthenticationDetails(details);

// your calls to Alfresco via WS

This should be working as well if you use a ServletFilter, so you get rid of that checkup.

authentication-services-context.xml defines the lifetime of a ticket that is being created on logon-time: per default one ticket does not invalidate at all.

Implement a SessionListener to destroy this ticket on session-destroy-time.

itsard
Champ in-the-making
Champ in-the-making
Hi,
How can i search a text in only some documents through SOAP webservice api.
My requirement is a content search that searches the input text only in some UUIDs or reference objects that I pass as input to the query.
Can you kindly help me with the query for it.

Thanks.

itsard
Champ in-the-making
Champ in-the-making
Hi,
Can anyone kindly let me know when exactly to use "repository services",when to use "SOAP Web Services Remote API" and
when to use "SOAP Web Service Client" as given on the link below
http://dev.alfresco.com/resource/docs/java/.
They all seem to b doing the same thing but with different classes and packages. I am trying to integrate my system using the soap webservice client apis with alfresco but I actually wish to know what are the other two service apis r about and when using them is better.
Thanks