weird behaviour of a Web Service

Hello everyone,

I'm currently writing a Rails application which should expose some web methods, which need to be called by a windows mobile application. I've been able to successfully call some webmethods from the mobile application, but only the methods returning simple types as strings, numbers, arrays etc.

Now I need to expose a method which receives an ActiveRecord object. In this case, I've witnessed a strange behaviour. If I write my method this way:

def get_role(role_id)      a = Role.find(role_id)      return a end

I get a "Cannot map Role to SOAP/OM" exception from the mobile application. Googling this error has lead me to this page: http://benrobb.com/2007/02/06/cannot-map-objtype-to-soapom/

so I rewrote the method as:

def get_role(role_id)     a = Role.find(role_id)     return Role.new(:description => "#{a.description}", ......[all the attributes here]) end

but in this case, the mobile application gives me a "FormatException" error. I cannot understand why, even if I'm returning a Role object in both cases, I get two different error messages! Where or what am I doing wrong?

Thanks in advance! Regards, Rey9999