AnsweredAssumed Answered

Ticket could not be found when calling callback handler

Question asked by belfast on Nov 3, 2012
Hi,
My code is as follows:

public AuthenticationDetails authenticate(String user, String passwd) 
   {
      if(authDetails != null) return authDetails;
      try {
         log.debug("Starting…");
         WebServiceFactory.setEndpointAddress("http://localhost/alfresco/api");
         WebServiceFactory.setTimeoutMilliseconds(10000);
         log.debug("have set endpoint");
         
         //authenticationService = WebServiceFactory.getAuthenticationService();
         
         
         //authResult = authenticationService.startSession(SYSTEM_USER, SYSTEM_PASSWORD);
         
         AuthenticationUtils.startSession(user, passwd);
         
         authDetails = AuthenticationUtils.getAuthenticationDetails();
         ticket = authDetails.getTicket();
         
         log.debug("got session");
      }
      catch(AuthenticationFault f)
      {
         log.debug("AuthFault: "+f.getFaultReason());
      }
      catch(RemoteException e)
      {
         log.debug("Remote excp: "+e.getMessage());
      }
      return authDetails;
   }

        public RepositoryServiceSoapBindingStub getRepositoryService() {
      RepositoryServiceSoapBindingStub stub = null;
      try{
         WebServiceFactory.setEndpointAddress("http://localhost/alfresco/api");
         WebServiceFactory.setTimeoutMilliseconds(10000);
         log.debug("have set endpoint");
         
         stub = WebServiceFactory.getRepositoryService();
         //stub.setPassword(ticket);
      }
      catch(Exception e)
      {
         log.debug("Exception: "+e.getMessage());
      }
      return stub;
   }

followed by

public ResultSet getChildrenOneDepth(String uuid) 
   {   
      QueryResult queryResult = null;
      try {
         RepositoryServiceSoapBindingStub repoService = am.getRepositoryService();
         Reference ref = new Reference();
         ref.setUuid(uuid);
         ref.setStore(spacesStore);
         
         queryResult = repoService.queryChildren(ref);
         
         if(queryResult == null) {
            log.debug("NoChildrenFound");
            return null;
         }
      }
      catch(RepositoryFault f)
      {
         log.debug("RepositoryFault: " +f.getErrorCode()+" - "+f.dumpToString());
      }
      catch(RemoteException e)
      {
         log.debug("RemoteException: "+e.getMessage());
      }
      return queryResult.getResultSet();
   }

i am getting a Remote exception as follows: WSHandler: password callback failed; nested exception is:
   org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.

To me it seems i may not have done something to set the ticket… What should i have done. It works intermittently and then there are times when it throws this exception.

Outcomes