Skip to Content

Something I like about Scripting Languages is the way they revel in having “more than one way to skin a cat”. So, in this spirit I have built a complementary interface to saprfc (for Ruby) called sapwas, that facilitates RFC calls via SAP Web Services. This has been integrated into sap4rails, and the attached example demonstrates how to substitue Web Services for RFC integration in Ruby on Rails.


SAP Web Services vs RFC?


Other than curiosity, there is another motivation for trying this out – Since there has been discussion of late on the merits of RFC and Web Service technology such as SOAP, I thought that inorder to do the subject justice I would do some further (tangible) investigation.

To me, the most obvious way to draw a comparison, is to develop comparable examples of each, with the only difference being the substitution of the technology in question.

This led to me focusing on a recent article I wrote:
Ruby on Rails with AJAX, to use as a base line.</p>


Activating the SAP Web Service support



If we take the example above (Ruby on Rails with AJAX), then the changes are as follows:

    • Install sapwas (version 0.02+)
    • Upgrade sap4rails (version 0.04+)
    • modify the SapUser model
    • set your Rails configuration


Install sapwas



Download either the source distribution, or the gem file  by following the sapwas project download links.  Gem files are easier to deal with – all you need to do is:
You will probably need to install http-access2 inorder to get the  basic authentication working correctly.  This is a requirement of the SOAP4R library.
</p>

Upgrade sap4rails



Download either the source distribution, or the gem file   for sap4rails by following the project download links.  First remove the old version, and install the new:


Modify the SapUser model


In the Rails application, edit the app/models/sap_user.rb, and change the super class for SapUser:


class SapUser < SAP4Rails::WS::Base
...


Set your Rails configuration


Modify the config/sap.yml file – you really should only need to add in the :url line depicted below, but check anyway:

client: "010"
url: "http://seahorse.local.net:8000/sap/bc/soap/rfc"
user: developer
passwd: developer
lang: EN


note on WAS configuration


You must ensure that /sap/bc/soap/rfc is configured/activated correctly in transaction SICF.


Go!



Once you have completed these changes, you can then test the Rails application as described in Ruby on Rails with AJAX – it should function in exactly the same manner – wasn’t that easy!


Now you have it working – I’ll leave you to draw your own conclussions on it’s merits 🙂
</p>

To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Ed Herrmann
    Piers,
    Great job. Currently, we are in the process of creating a rails application that will hopefully integrate with BI. We use your blogs for guidance all the time.  Without your connectors and tutorials, we would be lost.  I see a lot others in the community using them too.  Thanks for all your hard work.  Keep up the good work!

    -ewH

    (0) 

Leave a Reply