A simple example of an HTTP interaction might go as follows:
1. A browser makes a TCP/IP connection over the Internet to a server's TCP/IP Port 80 and transmits an HTTP request message containing:
An HTTP request method is a command sent to the HTTP server, such as GET MainPage.vxml HTTP/1.0. (See Table B-3 for a list of all HTTP request methods.)
An optional HTTP request header contains information about the browser so the server can customize its response.
An optional HTTP entity body contains information collected by the browser to be posted up to the server. This information is typically consumed by a Web application.
2. The server reads this message, then transmits an HTTP response containing:
A status line indicates the HTTP version, a status code (see Table B-1 for a list of HTTP status codes), and a short status description.
An HTTP response header provides information about the HTTP server and about the document that the server is responding with, including the document type specified as a MIME type (see Table B-2 for a list of MIME types often used in VoiceXML) and the length of the document.
The HTTP entity body is the actual payload of the HTTP response. This typically contains the document requested by the browser.
Using VoiceXML's catch element, you can catch each different HTTP response status code and handle it differently. For example, if you want to have a particular behavior for a 500 - Internal Server Error status code, you could catch this event with the following catch element:
<catch event="error.badfetch.http.500"> ... </catch>
Status code | Description | Description |
---|---|---|
100 | Continue | The request was a part of a multipart request. The client may continue with the next part. |
101 | Switching protocols | The server is responding to a request from the client to switch protocols. |
200 | OK | The request was successful. The requested resource will be sent with this response. |
201 | Created | The creation of a new URI as requested by the client was successful. |
202 | Accepted | The request was accepted but may not be processed until later. |
203 | Non-authorative information | The information in the header is not from the original source but perhaps from a copy or local cache. |
204 | No content | The requested document is empty. |
205 | Reset content | The client should clear any forms that may be posted to the server on a subsequent request. |
206 | Partial content | The server is returning a portion of the requested resource as requested by the client. |
300 | Multiple choices | The URI used to specify this resource is ambiguous. |
301 | Moved permanently | The requested URI has been moved permanently. The new URI is included in the Location HTTP response header item. The client should re-direct its request to that URI. |
302 | Moved temporarily | Similar to 301, but with the implication that the move is only temporary. |
303 | See other | Similar to 301 and 302. |
304 | Not modified | The server received an if-modified-since HTTP request header, but the resource requested has not been modified by the given date. |
305 | Use proxy | The server advises that the client redirect its request to the proxy server specified in the Location HTTP response header item. |
400 | Bad request | There was a syntax error in the client's request. |
401 | Unauthorized | The client is not authorized to retrieve the given resource. |
402 | Forbidden | The server can not transmit the given resource. |
404 | Not found | The requested resource was not found on the server. |
405 | Method not allowed | The method specified in the HTTP request is not allowed on this server. |
406 | Not acceptable | The requested resource exists but is not in one of the acceptable formats specified by the client in the HTTP request header. |
407 | Proxy authentication required | The proxy server needs to authorize the request before it can be processed. |
408 | Request time-out | The client did not complete its request within some server-specific time-out period. |
409 | Conflict | This request conflicts with another request. |
410 | Gone | The URI has been permanently removed. |
411 | Length required | The server requires a Content-Length HTTP request header. |
412 | Precondition failed | One or more of the if-headers in the HTTP request failed. |
413 | Request entity too large | The request's entity body is too large for the server to process. |
414 | Request URI too long | The request's URI is too long for the server to process. |
415 | Unsupported media type | The request's entity body is of an unsupported format. |
500 | Internal Server error | The server encountered an internal error (e.g. a bug in a Web application) and failed to generate a response. |
501 | Not implemented | The server does not support the request. |
502 | Bad gateway | The server received an invalid response from another server while trying to process this request. |
503 | Service unavailable | The service being requested is temporarily down. It will be available after the time specified in the retry-after HTTP response header item. |
504 | Gateway time-out | The server could not generate a response within a set time-out. |
505 | HTTP version not supported | The server does not support the version of HTTP specified in the request. |
MIME types are a standardized way of describing resource types such as images, audio clips, HTML documents, Microsoft Word documents, etc. Since a VoiceXML interpreter cannot interpret many of the formats popular in the browser-based WWW, the MIME types pertinent to VoiceXML are limited to text formats and audio formats. A brief summary of these MIME types is in Table B-2.
MIME type | Description |
---|---|
audio/32kadpcm | au, snd formatted audio files |
audio/basic | au, snd formatted audio files |
audio/x-aiff | aif, aiff, aifc formatted audio files |
audio/x-wav | wav formatted audio files |
message/http | a message expanding an HTTP status code |
text/html | an HTML document represented as plain text |
text/xml | an XML document represented as plain text |
text/plain | a text document with no markup |
18.189.188.121