cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Web Services Via Ruby

bdunbar
Champ in-the-making
Champ in-the-making
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:Smiley Surprisedbject: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', Smiley Tongueassword => '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
3 REPLIES 3

kim
Champ in-the-making
Champ in-the-making
Well, this "Alfresco's Ruby Library" seems non-existent and the testWebServices.rb is nowhere to be found..

May someone please shed some light on this, preferably by posting that said patch here verbatim?

Regards,
Kim

mikeh
Star Contributor
Star Contributor

frank_miller
Champ in-the-making
Champ in-the-making
Hi!

I know this is an old thread, but hope someone can help me. I'm trying to access an alfresco 3.2 instance from a ruby app. Followed every step described on the wiki, and ended up here, still getting the same error bdunbar mentioned. I've downloaded the project on http://forge.alfresco.com/projects/ruby/ but don't really understand the right way to apply the mentioned patch. Can somebody share any tip about how do the patch? Any help would be really appreciated.

Cheers!