On Thu, Apr 26, 2012 at 4:20 PM, Sherif Shehab Aldin
<silentquote@gmail.com> wrote:
> Hi All,
>
> I am developing some django apps, mostly they are adds to the django admin
> interface... What I need to do a lot is adding some Ajax calls, but I am a
> bit confused about weather It's better to provide those Ajax calls as web
> services like SOAP or REST, or I just create normal views.. I need to
> standardize those calls, I want to have a pattern to follow whenever I need
> to create new Ajax call to minimize the time needed to add new functionality
> and focus on the function Itself, cause currently every time I want to add a
> new call, I keep asking myself this question, and It confuses me a lot.
>
> Also I want to ask weather REST is only used to get,post, put and object or
> It can be just like a way to do RPC? cause most of examples for REST are
> just focusing on get/post an object.
>
> Your thoughts are highly appreciated. :-)
>
> Regards,
> Sherif.
>
It's not typical to use SOAP for AJAX calls, in fact I don't think
I've ever seen that. TBH, it's not typical to use SOAP at all unless
you are in the thrall of a tool manufacturer.
REST is all about objects, but this doesn't mean that you cannot do
RPC with REST, you just have to re-align your mindset. Instead of
calling a remote method, your REST call creates an object that gives
you the results you are interested in.
Eg, rather than calling a search service via SOAP to get a list of
items, you would create a SearchResults object with your arguments,
via REST. To access the results, you would use further REST calls to
examine attributes of the object.
The best way to architecture something like this is with a task queue
system like celery, creating a task to perform the search when the
SearchResults object is created, and testing/waiting for results to be
completed before returning data from attribute calls.
Cheers
Tom
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment