Forum: Ruby on Rails weird behaviour of a Web Service

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Rey9999 (Guest)
on 2009-02-10 13:29
(Received via mailing list)
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
This topic is locked and can not be replied to.