Results 1 to 3 of 3

Thread: Ruby On Rails JSON webservice plugin

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Urmond, Netherlands
    Posts
    51
    Rep Power
    10

    Default Ruby On Rails JSON webservice plugin

    I created a plugin for Ruby On Rails so that the activeWebservice can send back a JSON respond instead of a SOAP respond. It chooses the way it responds (JSON or SOAP) to look at a HTTP header (SOAPReturnFormat). If the header is not present, has the value SOAP or has an incorrect value then a SOAP respond is given. If it has the value JSON then a JSON respond will be given.

    I rather used the header of the xml envelope but till now it is not clear to me how I can read from it. I must probably decode the soap respond again because the normal behavour of the activeWebservice discards the header. For now I am happy that I succeeded with the HTTP header.

    The plugin is far from stable (it hasn't been tested a lot, so bugs are expected) and I question if I build the plugin the correct way. But what the hell, it works.

    For everybody who wants to give Ruby On Rails together with ZimbraTK a try, you can download the plugin at http://www.smies.com/projects/ror_pl...ervice_0.1.zip .

    You must know that Zimbra uses SOAP1.2 and Ruby on Rails SOAP1.1. This is not a big problem but you must be aware of two things in your ZimbraTK.
    1. The AjxSoapDoc._SOAP_URI must be set to http://schemas.xmlsoap.org/soap/envelope/.
    2. You must send the HTTP header SOAPAction with your request.
      This header contains the path to the soap service( without the domain and the protocol) and the name of the action, seperated with a / .
      Example:
      service = http://localhost:3000/backend/api
      action = FindProductById
      SOAPAction = /backend/api/FindProductById


    I will probably create a small package for ZimbraTK in the future that can switch between SOAP 1.1 and SOAP 1.2. When it is done I will share the code.

  2. #2
    Join Date
    Oct 2005
    Location
    Urmond, Netherlands
    Posts
    51
    Rep Power
    10

    Default Update

    I made a small update to the plugin. You can download the new version from:
    http://www.smies.com/projects/ror_pl...vice_0.1.1.zip

    CHANGELOG:

    VERSION 0.1.1
    -------------------------------------
    * The Code property of the Fault object in the return now contains the classname of the thrown exception
    Last edited by smies; 11-07-2005 at 12:18 PM.

  3. #3
    Join Date
    Oct 2005
    Location
    Urmond, Netherlands
    Posts
    51
    Rep Power
    10

    Default

    I released a new version (0.1.3) of my json_webservice for Ruby on Rails.

    Changes:
    - When a Time class is encounterd it will be converted to a string with the international date time format: %Y/%m/%d %H:%M:%S.
    It is only a minor bugfix but is also only a small plugin.

    You can download the plugin here.

    Enjoy..

Similar Threads

  1. Zimbra and Ruby On Rails
    By JoshuaPrismon in forum Developers
    Replies: 7
    Last Post: 05-09-2006, 05:01 PM
  2. ZimbraTK and Ruby on Rails article
    By smies in forum Developers
    Replies: 0
    Last Post: 11-21-2005, 04:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •