cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Question

mcirwin
Champ in-the-making
Champ in-the-making
How do you use the Alfresco web services from another, non-Alfresco web application (potentially on a physically separate server)?

I have tried and tried to get this working; I just can't get past the ticket errors, nor can I find any documentation to tell me.
By implementing my own copies of AuthenticatonUtils, WebServiceFactory and CookieHandler I managed to get a login to succeed, but it is then impossible to browse (I get a ticket error).  I do not think I should have to re-implement Alfresco code to get any of this working and I am pretty sure I am missing something fundamental.

Please, someone must have done this; can anyone help?
5 REPLIES 5

sdavis
Champ in-the-making
Champ in-the-making
Have you seen the SDK which provides code samples on this http://wiki.alfresco.com/wiki/Alfresco_SDK

Also, are you set on web services already?  or is a RESTful approach an option http://wiki.alfresco.com/wiki/Web_Scripts

mcirwin
Champ in-the-making
Champ in-the-making
Yes, I have looked at the SDK and the code samples.  I have also searched all the documentation.  I can use the Web Services to log in and, if I follow the examples to the letter and run them from a command prompt, I can do pretty much whatever I want.  As soon as I try to use the Alfresco web services within a  Tomcat hosted web application, I get ticket errors.

Unfortunately I can't find any example/documentation which actually shows you how to use the Alfresco web services from a separate web application.  And from searching these forums, it appears that I am not the only one.  I struggle to understand why the Alfresco web services manage to lose my ticket between calls.  I am sure that I am safely holding a copy of the Alfresco ticket for the current user-session on my own application and I provide that for all subsequent web service calls after a successful login, e.g.
RepositoryServiceSoapBindingStub repositoryService = WebServiceFactory.getRepositoryService();
        repositoryService.setPassword(user_ticket);

After this I get the ticket exception:
ERROR [Thread-4] (RRepositoryAlfImp.java:428) - Remote exception
AxisFault
faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.generalException
faultSubcode:
faultString: WSDoAllSender: password callback failed; nested exception is:
   org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
faultActor:
faultNode:
faultDetail:
   {http://xml.apache.org/axis/}hostname:vmw-dev-app-ji

WSDoAllSender: password callback failed; nested exception is:
   org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
   at org.apache.ws.axis.security.WSDoAllSender.performCallback(WSDoAllSender.java:940)
   at org.apache.ws.axis.security.WSDoAllSender.readPwViaCallbackClass(WSDoAllSender.java:901)
   at org.apache.ws.axis.security.WSDoAllSender.getPassword(WSDoAllSender.java:859)
   at org.apache.ws.axis.security.WSDoAllSender.performUTAction(WSDoAllSender.java:465)
   at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:314)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
   at org.apache.axis.client.Call.invoke(Call.java:2443)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub.queryChildren(RepositoryServiceSoapBindingStub.java:800)
   at com.company.repository.alfresco.abstraction.RRepositoryAlfImp.getRootContainersImp(RRepositoryAlfImp.java:422)
   at com.company.common.abstraction.RRepository.getRootContainers(RRepository.java:77)
   at com.company.reppace.model.RepositoryNode$UpdaterThread.run(RepositoryNode.java:63)
   at java.lang.Thread.run(Unknown Source)
Caused by: org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
   at org.alfresco.webservice.util.AuthenticationUtils.handle(AuthenticationUtils.java:151)
   at org.apache.ws.axis.security.WSDoAllSender.performCallback(WSDoAllSender.java:938)
   … 18 more

I am not sure that WebScripts are appropriate for what I am trying to do, but I will read the link you provided.

Thanks.

morpheus
Champ in-the-making
Champ in-the-making
OK may be i got the same problem!
i downloaded the SDK and all WS samples are working fine !
But when copied the GetStores Sample into my own Project (with an dependency to the  AlfrescoRemote Project) It also works too !
BUT WHY ?  i got no webservices.properties in my Project, so where the hell does this app know that the server listens on localhost ? , is it default ?

i already found out:
yes localhost is DEFAULT!!! not that nice, it would be better to throw something or put an info to the logger!!
and the file´s name is webserviceclient.properties not webservice,properties

harishns
Champ in-the-making
Champ in-the-making
Hi,
I have the same problem, when I run jUnits from the SDK, it is working. if I copy to my own project, same code is throwing following error


org.apache.ws.security.WSSecurityException: WSHandler: password callback failed; nested exception is:
   org.alfresco.webservice.util.WebServiceException: Ticket could not be found when calling callback handler.
   at org.apache.ws.security.handler.WSHandler.performCallback(WSHandler.java:736)
   at org.apache.ws.security.handler.WSHandler.readPwViaCallbackClass(WSHandler.java:712)
   at org.apache.ws.security.handler.WSHandler.getPassword(WSHandler.java:670)
   at org.apache.ws.security.action.UsernameTokenAction.execute(UsernameTokenAction.java:35)
   at org.apache.ws.security.handler.WSHandler.doSenderAction(WSHandler.java:197)
   at org.apache.ws.axis.security.WSDoAllSender.invoke(WSDoAllSender.java:170)
   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
   at org.apache.axis.client.AxisClient.invoke(AxisClient.java:127)
   at org.apache.axis.client.Call.invokeEngine(Call.java:2784)
   at org.apache.axis.client.Call.invoke(Call.java:2767)
   at org.apache.axis.client.Call.invoke(Call.java:2443)
   at org.apache.axis.client.Call.invoke(Call.java:2366)
   at org.apache.axis.client.Call.invoke(Call.java:1812)
   at org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub.update(RepositoryServiceSoapBindingStub.java:986)

any suggestion feels me great
Thanks in advance

cheffilet
Champ in-the-making
Champ in-the-making
BUT WHY ?  i got no webservices.properties in my Project, so where the hell does this app know that the server listens on localhost ? , is it default ?

Right,  its default. Please stick around at at http://forums.alfresco.com/en/viewtopic.php?f=4&t=20603&start=15#p73799 where i commented on this.