ActiveResource server

Can anyone point me to documentation, how to’s, etc about how to create
an active resource server. I get its trivial to create a client. But
I’m wanting to create a server that can be used by input forms and also
by an active resource client.

The big mystery to me is how (or if) the xml coming in from an active
resource client gets transformed into the normal “params” argument and
how exactly does that happen? Is it configurable? etc.

Pointing to the code that does this would work too.

I’m not sure I’m being clear but I hope so.

Thank you,
pedz

Isn’t this just a matter of setting up your rails app RESTfully?

I don’t think you have XML coming in from the client–just HTTP
requests, with a URI (from which the routing magic derives many incoming
parameters, just like it does when a request comes from a browser) and
verbs (get/post, etc.) and session vars. From the point of view of your
app, you don’t care whether the request came from a browser or an active
resource client–communication happens, things get created, moved
around, deleted, etc. :wink:

Probably some of that is wrong–but my understanding is that the main
reason you’d bother with the REST stuff is that you wind up w/an
automatable application.

I think that is all correct but I’ve never seen anyone talk about how
the xml input gets remapped.

Thats the part that I’m trying to understand in particular.

Thanks

On 21 May 2008, at 00:04, Perry S. wrote:

I think that is all correct but I’ve never seen anyone talk about how
the xml input gets remapped.

IIRC, it’s via ActiveRecord’s from_xml method

Fred

Frederick C. wrote:

On 21 May 2008, at 00:04, Perry S. wrote:

I think that is all correct but I’ve never seen anyone talk about how
the xml input gets remapped.

IIRC, it’s via ActiveRecord’s from_xml method

Fred

Thanks! I grep’ped around and found where
parse_formatted_request_parameters does the magic.

Thank you again…

@Perry,

Just to be clear… You have one app with RESTful routes that does
all the typical stuff that you expect to do using ActiveRecord.
Normal forms posting to create and update, etc. If you’ve used the
‘normal’ scaffolded controllers you don’t need to do anything new
here.

Then there’s the "ActiveResource’ application. This application does
the same basic thing as the previous one with respect to HTTP
requests. The difference is that the ActiveResource models use
something similar to ‘formated_model_path(@model, :xml)’ to do CRUD.
That means they don’t send requests in XML – they send ‘normal’ http
requests and ask for the response in XML. ActiveResource consumes
xml (ActiveResource::Base#load_attributes_from_response). The onus is
on the ActiveResource model to parse XML, not your controllers.

HTH,
Andyv

On May 20, 8:26 pm, Perry S. [email protected]