AnsweredAssumed Answered

Alfresco Web Services Via Ruby

Question asked by bdunbar on May 24, 2007
Latest reply on Apr 16, 2012 by frank_miller
I am trying to get Ruby to interface with Alfresco web services. I am following the instructions on the wiki (http://wiki.alfresco.com/wiki/Web_Service_Samples_for_Ruby). I am successfully authenticating with the server and getting a ticket, but any operations after that seem to be failing with the following message in the Ruby console:

#<SOAP::Mapping::Object:0x34b82d4>: Server Error (SOAP::FaultError)

One thing that may be causing this is that the wiki says:

"In addition to installing this library, and because this library is not fully implemented, you will have to patch it with the patch containing MessageText code instead of the default MessageDigest."

I could not find any documentation on what that meant on the wiki or by doing an pretty extensive Google search. So, I have not done any patching.

Here is the sample code I am trying to run, and it is pretty much like the code in the Wiki.

require 'soap/wsdlDriver'
require "wss4r/rpc/wssdriver"
require "wss4r/tokenresolver/authenticateuserresolver"
require "pathname"

authentication_wsdl_url = "file://" + Pathname.new(File.dirname(__FILE__)).realpath + "/../wsdl/authentication-service.wsdl"
authenticator = SOAP::WSDLDriverFactory.new(authentication_wsdl_url).create_rpc_driver()
authentication_result = authenticator.startSession(:username => 'admin', :password => 'admin').startSessionReturn
p authentication_result
ticket = authentication_result.ticket
p ticket

repository_wsdl_url = "file://" + Pathname.new(File.dirname(__FILE__)).realpath + "/../wsdl/repository-service.wsdl"
repository = SOAP::WSDLDriverFactory.new(repository_wsdl_url).create_rpc_driver()

# adding authentication information
resolver = Tokenresolver::AuthenticateUserResolver.new()
repository.security().add_security_resolver(resolver)
repository.security().add_security_token(UsernameToken.new(authentication_result.username, ticket))


# the query itself
#query_result = repository.query({:store => {:scheme => 'workspace', :address => 'SpacesStore'},
#                                 :query => {:language => 'lucene', :statement => 'TEXT:"hello"'},
#                                 :includeMetaData => false})
stores = repository.getStores({})
p stores


I have tried with the commented out query as well and that ended up with the same result.

Does anyone have any ideas what I am doing wrong? Or, do you have any suggestions on at least finding out where the problem is? I could not find anything in the alfresco log.

Thanks in advance for your help,

Brian

Outcomes