Page 1 of 1

What defines this process best

Posted: Sat Apr 21, 2007 3:08 pm
by alex.barylski
Invocation from the outside world, no HTML returned or anything. Accepts GPC data and carries out an action on the datastore of choice.

For example:

http://www.domain.com/scripts/create_user.php

1) Script
2) Event
3) AJAX
4) RPC

Script would fine but this is part of an MVC architecture so that doesn't really jive. Event, is really either or, could return HTML might not. AJAX same thing but without a refresh.

For those reasons I'm leaning towards RPC (although strictly not RPC as the handler will typically be invoked using AJAX locally).

I suppose the process of sending a client request to a remote server is something of RPC, but still.

These are rough definitions I have provided, i'm not looking for indepth disscussion on what each actually are...I just want an opinion. :)

Posted: Sat Apr 21, 2007 3:48 pm
by nickvd
RPC meaning Remote Procedure Call, I would agree with your assessment...

Posted: Sat Apr 21, 2007 7:36 pm
by Maugrim_The_Reaper
Note the HTTP spec only allows for actions to be performed using a POST request. GET should only return an existing resource from existing data. This is the recommended interpretation to reduce the risk of applications falling afoul of CSRF exploits.

Script is just a name for the server-side file - has nothing to do with the Request process itself. It could be loosely termed an event, since it evokes a remote action based on user activity from the browser. At the end of the day it would be a HTTP POST request + parameters which in web services terms is called a RESTful request - so it's not RPC because there's no defined method call interface. If the interface is the URI then you're back to REST.

Lastly, there is always a response. Even an empty body counts because headers are responses ;). A HTTP code must be returned to tell the browser something happened. For both REST and RPC there should be a body explaining to the requester if the expected action was successful or not.

In summary, if its POST + parameters it's no different to a form submission which is REStful. So the closest option on the list is Event since at a minimum it's reacting to user actions. If you want a cleaner name you need a use case to show the context and request method.