B.2. GET versus POST

The VoiceXML element types submit and subdialog both provide a method attribute allowing the VoiceXML developer to choose whether to use HTTP GET or HTTP POST to push data from the VoiceXML interpreter up to the server. This section will briefly examine the differences between these two methods.

The HTTP GET method is typically used to get information from the server. Dynamic Web applications, however, often require that the client pass parameters up to the server when requesting a page. The HTTP GET method was extended to allow these parameters to be appended to the end of the URL, for example:

http://www.example.com/doc.vxml?firstName=JohnlastName=Smithage=75

A question mark (?) after the resource name introduces a list of parameters. The parameters are presented using the name=value syntax. Each name/value pair is separated by an ampersand (&).

A more efficient way to pass parameters up to the server is by using the HTTP POST method. This method embeds the parameters right into the HTTP request itself (in the request's entity body). While less efficient, the HTTP GET method can sometimes be easier for debugging because the parameters are visible immediately in the URL portion of the request (typically seen in server logs). However, the HTTP POST method is more secure because you would have to dissect the actual packets to view the POST data. If this data were transmitted over HTTP's encrypted cousin HTTPS, hacking secure POST data would become much more difficult.

HTTP supports several other methods in addition to GET and POST. These are summarized in Table B-3.

Table B-3. Other HTTP request methods
MethodDescription
GETRequests that the specified resource be retrieved from the server.
HEADSimilar to the GET method, but the client indicates that the server should only send the header information, not the entire document.
POSTRequests that the data in the HTTP entity body be sent up to the server. The server should respond with a resource associated with the request's URI and the contents of the POST data.
LINKRequests that the given header information be associated with the document on the server at the given URI.
UNLINKRemoves an association established using the LINK method.
PUTRequests that the contents of the request entity body be uploaded and stored on the server at the given URI.
DELETERequests that the resource at the given URI be deleted.
OPTIONSRequests that the server describe its communications abilities.
TRACERequests that the server simply return the entity body as it was sent (used for debugging).

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.85.72