Forum: Ruby on Rails Webservices and submitting object with associations

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.
34791e1d8c4def65f9b93294638a7e04?d=identicon&s=25 Joerg Diekmann (joergd)
on 2006-01-26 12:28
Hi - is there an easy way to submit an object with its associations as
an :expects parameter to a AWS webservice?

I know I could first create a webservice method for the object, and then
call - in a loop - another webservice for each of my association
objects.

Is there an easier more elegant way, so that I don't have to make so
many expensive webservice calls?

I was thinking creating my own XML document for this, and passing it
into a :string or a :base64 :expects parameter. Sound reasonable?

Thanks
Joerg
Fd253af856561ecdb8a557193ceadf3b?d=identicon&s=25 Andrew Foster (Guest)
on 2006-01-26 15:59
(Received via mailing list)
Hi Joerg,

> Hi - is there an easy way to submit an object with its associations as
> an :expects parameter to a AWS webservice?

Is it possible to use an ActionWebService::Struct in an :expects? You
can
certainly use it in a :returns. So something like:

    class AwsTree < ActionWebService::Struct
        member :id,   :int
        member :name, :string
    end

    class TreeApi < ActionWebService::API::Base
        api_method :get_tree_by_struct,
                   :expects => [[AwsTree]],
                   :returns => [{:treeid => :int}]
    end

    class Tree < ActionWebService::Base
        web_service_api TreeApi
    end

HTH,

- Andrew
This topic is locked and can not be replied to.