Customizing XML response with Web services implementation using AWS


#1

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 tag generated to represent different
array elements.

now if we need to cusomize the name of these node with some
specific name as 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.