View Rahoul Baruah's profile on LinkedIn Basecamp project management and collaboration

The blog of Rahoul Baruah from 3hv Ltd

What's going on?

My name is Rahoul Baruah (aka Baz) and I'm a software developer in Leeds (England).

This is a log of things I've discovered while writing software in Ruby on Rails. In other words, geek stuff.

However, I've decided to put this blog on ice - I would ask you to check out my business blog here (or subscribe here).

03 July, 2006

The Joy of SOAP

I've got a few Rails related jobs lined up over the next few weeks, so there'll probably be an RForward update coming soon as I work on getting the thing deployed on a number of customer sites.

However, I thought I better pass on a bit of ActionWebService (1.1.3) wisdom.

Firstly, when using ActiveRecord::Migrations, mark your date/time columns as of type :date (not :datetime). Otherwise ActionWebService will fail to marshal the actual values out of your model and out into the service (:datetime resolves to a Time object - ActionWebService calls DateTime.parse(value.to_s) which fails - :date resolves to a DateTime object, meaning the call to DateTime.parse works).

Secondly, when writing your SOAP API, if an operation does not take any parameters you must explicitly declare it as such. In Rails 1.0.X you could write api_method do_something, :returns => [[Stuff]] whereas in Rails 1.1.X you have to write
api_method do_something, :expects => [], :returns => [[Stuff]]

1 comment:

Baz said...

Actuall

y the :date advice does not always work. I'm not quite sure what is going on apart from some fields are sometimes being passed through to ActionWebService as :time/:date/:datetime but actually as objects of class Time.

This is fine for :time fields but not for :date or :datetime as Date.parse(t.to_s) and DateTime.parse(t.to_s) both fail when t.is_a? Time

The answer (short-term at least) is a modification to casting.rb ... I will post it later.

eXTReMe Tracker