Reply
Casual DocuSign User
schleg
Posts: 3
Registered: ‎09-09-2011
Accepted Solution

Ruby on Rails DocuSignSample

I'm trying to get the sample RoR app to run. I entered my credentials in the docusign.yml file, started the server, and out-of-the-box I get 

 

OpenSSL::X509::StoreError in LoginsController#new
system lib
Rails.root: /Volumes/SugarPod/Dropbox/source/DocuSign-eSignature-SDK/Ruby/DocuSignSample
Application Trace | Framework Trace | Full Trace
app/controllers/logins_controller.rb:30:in `new'

 

I'm using Ruby 1.8.7 and Rails 3.0.4

 

Anything obvious I should look at first?

Moderator
nicholasareed
Posts: 255
Registered: ‎05-19-2011

Re: Ruby on Rails DocuSignSample

Yes, if you look at the

/config/initializers/docusign.rb

 

 you'll need to change lines

Docusign::Config[:ca_file] = '/usr/lib/ssl/certs/ca-certificates.crt'

 to reflect where your CA file is stored. 

Casual DocuSign User
schleg
Posts: 3
Registered: ‎09-09-2011

Re: Ruby on Rails DocuSignSample

Thanks, that was the ticket! For future reference (for anyone with this same issue) I had to create an SSL cert with openssl on Mac OSX like this--

 

sudo openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key 

sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout privateKey.key -out ca-certificates.crt

 

I had to sudo create the path /usr/lib/ssl/certs

 

Anyway, works now. Looking forward to checking it out.

Casual DocuSign User
nickhammond
Posts: 5
Registered: ‎10-01-2011

Re: Ruby on Rails DocuSignSample

I've added this to my config/initializers/docusign.rb file but it doesn't seem to be loading in that configuration because I'm still getting the certificate verify failed. I have a ca-certificates file that it's pointing to and am using for another connection, what does your connection function look like? Is the Docusign::Config[:ca_file] value used anywhere besides setting it in that initializer?

Casual DocuSign User
nickhammond
Posts: 5
Registered: ‎10-01-2011

Re: Ruby on Rails DocuSignSample

I can see that the Docusign::Config hash has everything in there properly just not following where it gets passed over to soap4r. Any tips?

Casual DocuSign User
schleg
Posts: 3
Registered: ‎09-09-2011

Re: Ruby on Rails DocuSignSample

Here's my docusign.rb initializer--

 

require 'docusign'

Docusign::Config = HashWithIndifferentAccess.new(YAML.load_file("#{Rails.root}/config/docusign.yml")[Rails.env])

Docusign::Config[:verify_mode] = OpenSSL::SSL::VERIFY_PEER Docusign::Config[:ca_file] = '/usr/lib/ssl/certs/ca-certificates.crt'

 

although I don't think I had to change that. Once I added the cert file I could just run the Rails app as expected. In docusign.yml make sure you are using your email address for the user_name valuep.

Casual DocuSign User
nickhammond
Posts: 5
Registered: ‎10-01-2011

Re: Ruby on Rails DocuSignSample

Thanks for the reply, this issue has been driving me crazy. My docusign.rb initializer looks the same I'm just not seeing where the docusign gem actually picks up or uses that information, does it need to be in the connection somewhere? Is there another method that utilizes the ca_path? It's strange because open-uri picks up on my ca certificates file without pointing it somewhere but I know that's part of the problem with soap4r.

 

Gems:

soap4r-1.5.8

docusign-0.8.0

 

  def docusign_connection
    @docusign_connection ||= Docusign::Base.login(
      :integrators_key => Docusign::Config[:integrator_key],
      :email => current_account.docusign_username,
      :password     => current_account.docusign_password,
      :endpoint_url =>Docusign::Config[:default_endpoint_url],
      :wiredump_dev => STDOUT
    )
  end
Moderator
nicholasareed
Posts: 255
Registered: ‎05-19-2011

Re: Ruby on Rails DocuSignSample

You need the docusignsdk gem instead of docusign. We modified the old docusign gem to include the ca_cert configuration (so that it can run on Heroku). 

Casual DocuSign User
nickhammond
Posts: 5
Registered: ‎10-01-2011

Re: Ruby on Rails DocuSignSample

Great, thank you! I'll try that out today. I saw the docusignsdk gem in a couple articles but it was unclear if that was just renamed to the docusign gem since all of the github pages and everything 404. Any plans on getting this added into the official docusign gem?  Accepting pull requests?

Moderator
nicholasareed
Posts: 255
Registered: ‎05-19-2011

Re: Ruby on Rails DocuSignSample

Definitely accepting pull requests! The current docusignsdk gem is at https://github.com/nicholasareed/docusignsdk

Casual DocuSign User
nickhammond
Posts: 5
Registered: ‎10-01-2011

Re: Ruby on Rails DocuSignSample

Is there an official docusign gem or one that Docusign keeps up to date on? I know there's two out there right now.

 

https://github.com/nicholasareed/docusignsdk

https://github.com/texel/docusign

 

Just wondering if you can provide some clarification on each, some of the documentation uses docusignsdk, some uses just the docusign gem. 

Moderator
nicholasareed
Posts: 255
Registered: ‎05-19-2011

Re: Ruby on Rails DocuSignSample

We're working on clarifying that (and thanks for the Pull Request, I'll take a look and get it in very soon). The docusignsdk is the same as the previous docusign gem, but we were not able to edit the old one as easily. We'll soon host the docusignsdk gem on the DocuSign GitHub account and change over the docs. 

Casual DocuSign User
whather
Posts: 2
Registered: ‎01-05-2012

Re: Ruby on Rails DocuSignSample

Does the docusign api support Ruby 1.9+ and Rails 3.1? I'm really close to having it integrated, but I'm using the ruby1.9 branch of docusign (https://github.com/texel/docusign/tree/ruby19) instead of the docusignsdk branch which I can't get working in Ruby 1.9. Using the ruby1.9 docusign source, I'm forced to use the gem "mumboe-soap4r" instead of the regular "soap4r" one. 

 

The gems are loading fine but now I'm getting this error when calling Docusign::Base::login():

 

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):

 

I do have my ca_file set in docusign.rb: Docusign::Config[:ca_file] = '/usr/lib/ssl/certs/ca-certificates.crt'

 

And ca-certificates.crt does exist in that location. Any clues?

 

Thanks.

Moderator
nicholasareed
Posts: 255
Registered: ‎05-19-2011

Re: Ruby on Rails DocuSignSample

The API is language-agnostic (it will accept an incoming request from any language). 

 

The "docusignsdk" and "docusign" gems are nearly the same, I believe the only difference is "docusignsdk" has cert file location options. 

 

In https://github.com/texel/docusign/blob/ruby19/lib/docusign/base.rb check under "def credentials" and compare it to https://github.com/nicholasareed/docusignsdk/blob/master/lib/docusign/base.rb

 

To have your cert file specified, I believe you need to include: 

      def configure_ssl(connection)
        connection.options["protocol.http.ssl_config.verify_mode"] = Docusign::Config[:verify_mode] if Docusign::Config[:verify_mode]
				connection.options["protocol.http.ssl_config.ca_file"] = Docusign::Config[:ca_file] if Docusign::Config[:ca_file]
				connection
      end

 

 

Casual DocuSign User
whather
Posts: 2
Registered: ‎01-05-2012

Re: Ruby on Rails DocuSignSample

I was just looking at those diffs when I got your reply :). I'll branch it and include the cert additions. Thanks.