Piyush with Rails
2009-Mar-09 10:59 UTC
Customizing XML response with Web services implementation using AWS
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Piyush with Rails
2009-Mar-09 10:59 UTC
Customizing XML response with Web services implementation using AWS
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.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---