Tuesday, 18 January 2011

Ruby and Salesforce Integration

With the announcement that Salesforce acquired the cloud platform Heroku I had to take a more vested interest in Ruby. Though I was aware of the capabilities of Ruby I would definitely consider myself a newbie with this type of programming. In order to jump on the bandwagon I started an extensive Ruby programming class which will allow me to build my skill set over the next couple of months.

That being said learning Ruby is great and all but the key is using it within the Salesforce platform. The next couple of posts will describe how we will use SOAP to integrate Ruby and Salesforce.

-First you need to install Ruby.  InstantRails 2.0 is radical.
-Access your developer account. Go to Setup->Develop->API then choose "enterprise.wsdl" and save it. Here is an example:

D:\RubyRails\rails_apps\sfdc\enterprise.xml

-Open the Ruby console and then install ‘SOAP4R’ by using this command:

gem install soap4r

You may get an error after running this command that reads "Errno::EADDRNOTAVAIL". This will happen if your Ruby gems are outdated. This is a simple problem to fix by going to the following site:


-After downloading the gems send them to a directory. You can then access that directory from the command line.
-Install the gems with the following command:

ruby setup.rb

At this point everything should be properly installed and you should not run into any errors. Go to the directory where you saved the ‘enterprise.xml’ and use the following command:

ruby wsdl2ruby.rb --wsdl D:\RubyRails\rails_apps\sfdc\enterprise.xml --type client –force

If everything goes well there should be four new files in your Salesforce directory. First step is complete! Next post we will use a code generated from Andrew’s (Super-size) Interwebdiary to generate an easy login function.

Till then fingers crossed the Jets get smashed by the Steelers this weekend.

No comments:

Post a Comment