Hello,
I am using ActiveResource to integrate with a 3rd party service.
when calling MyModel.save a POST with xml is sent.
I need to make sure that xml is created with defined order of
elements (the service requires it) How can I do that?
Some have suggested using rxml or builder, but I am not sure how. Has
anyone done this before?
SalesDocument < ActiveResource
I need to make sure that when I call
@sales_document.save
the order of elements in the xml is predetermined and consistent,
which currently not the case.
POST http:///sales_documents.xml
body: <?xml version="1.0" encoding="UTF-8"?>
On Mon, Aug 3, 2009 at 10:56 PM, Slava
Mikerin[email protected] wrote:
I am using ActiveResource to integrate with a 3rd party service.
when calling MyModel.save a POST with xml is sent.
I need to make sure that xml is created with defined order of
elements (the service requires it) How can I do that?
Some have suggested using rxml or builder, but I am not sure how. Has
anyone done this before?
I haven’t, but e.g. the Builder API looks pretty straightforward:
I am stuck… here is what i tried
class SalesDocument < ActiveResource::Base
def encode
SalesDocumentsController.new.render_to_string :template, ‘rxml-file’
end
end
thanks, I am not sure how to make my model convert to xml for POST
according to builder rules…
currently it uses a hash to represent all fields and calls hash.to_xml
but hash is unordered so no predictability. this is my specific problem
Hassan S. wrote:
On Mon, Aug 3, 2009 at 10:56 PM, Slava
Mikerin[email protected] wrote:
I am using ActiveResource to integrate with a 3rd party service.
when calling MyModel.save a POST with xml is sent.
I need to make sure that xml is created with defined order of
elements (the service requires it) �How can I do that?
Some have suggested using rxml or builder, but I am not sure how. Has
anyone done this before?
I haven’t, but e.g. the Builder API looks pretty straightforward:
I am stuck… here is what i tried
class SalesDocument < ActiveResource::Base
def encode
SalesDocumentsController.new.render_to_string :template, ‘rxml-file’
end
end
On Mon, Aug 3, 2009 at 11:21 PM, Slava
Mikerin[email protected] wrote:
thanks, I am not sure how to make my model convert to xml for POST
according to builder rules…
currently it uses a hash to represent all fields and calls hash.to_xml
but hash is unordered so no predictability. this is my specific problem