tags:

views:

28

answers:

1

Hi-

I am trying to find out more low-level details on the HTTP requests that various JS/AJAX frameworks create when sending JSON POST requests to the web server. I am looking most importantly for information on the following frameworks (but info about any other notable exceptions is appreciated): .net, jquery, prototype, DWR and MooTools.

What I want to know is, when these frameworks make calls to different "methods" on the server, what (in the HTTP request) differentiates the different method calls? So far I have seen the following:

  1. The URL differentiates the method calls, i.e. "POST /app/s.svc/method1 HTTP/1.1" versus "POST /app/s.svc/method2 HTTP/1.1" etc.
  2. The URL is the same for different method calls, but an HTTP header differentiates the method calls, i.e. "X-AjaxPro-Method: method1" versus "X-AjaxPro-Method: method2" etc.

Are there other examples of "multiplexing" method calls to the same URL other than with HTTP headers? Does the JSON itself ever contain the method name, without an indication in the HTTP headers, like a SOAP method that is contained only within the SOAP:Body, without a corresponding "SOAPMethodName" header? Are there any other cases that I haven't though of?

Thanks for your help.

A: 

In HTTP you don't address methods you address resources. Looking at it from a Framework independent view the HTTP Specification offers three main Methods namely GET, POST, PUT and DELETE on a resource (lets say http://example.com/users/2 which is a user with the id 2). The software architectural style behind this idea of resources and the uniform Interface of these four methods is called REST.

If you follow this architectural style there are many frameworks that can work with it and it uses the HTTP protocol as it is supposed to (sending X-AjaxPro-Method in the header is definitely not HTTP standard compliant).

Daff