Forum: Ruby on Rails Customizing XML response with Web services implementation using AWS

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.
Piyush with Rails (Guest)
on 2009-03-09 13:00
(Received via mailing list)
Hi All,

I am using Action web service's layered dispatching to implement web
service apis in rails.

I want to know that how can we customize the XML response generated by
AWS as the response for API Call.

For an example take below thing in consideration.


API Method signature
--------------------------------------

class ProductAuthApi < ActionWebService::API::Base

   api_method :find_all_products,
   :expects => [:string}],
   :returns => [[Product]]

end

Product Struct class
----------------------------------

class Product < ActionWebService::Struct

  member :id, :integer
        member :name, :string
end


Now if we implement API service and return the array of structure type
Product and
invoke the service,In the response we will get the Array of Product
class object.

But if we look at the response XML generated by AWS for this API
request, there are many <item> tag generated to represent different
array elements.

now if we need to cusomize the name of these <item> node with some
specific name as <product> in response xml then how can we do that ?

and also if we need to add the attribute to these nodes for uniquely
identifying them then how can we do that?

Thanks in advance.

Thanks,
Piyush.
This topic is locked and can not be replied to.