# Webservices and submitting object with associations

**URL:** <https://www.ruby-forum.com/t/webservices-and-submitting-object-with-associations/97544>\
**Category:** Rails\
**Created:** [January 26, 2006, 12:28pm UTC](https://www.ruby-forum.com/t/webservices-and-submitting-object-with-associations/97544 "2006-01-26T12:28:33Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![joergd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@joergd](https://www.ruby-forum.com/u/joergd)\
**Post date:** [January 26, 2006, 12:28pm UTC](https://www.ruby-forum.com/t/webservices-and-submitting-object-with-associations/97544/1 "2006-01-26T12:28:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![joergd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/51bf81/32.png) [@joergd](https://www.ruby-forum.com/u/joergd)\
**Post date:** [January 26, 2006, 3:59pm UTC](https://www.ruby-forum.com/t/webservices-and-submitting-object-with-associations/97544/2 "2006-01-26T15:59:41Z")

</div>

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
