The <submit> element
The submit element is what allows our voice application to deliver data to a server for integration with the wider world of the Web.
In our example, we delivered data to the server using the following:
<submit next="http://www.myserver.com/servlet/login" Method="GET" namelist="phone_number pin"/>
And if the server has been set up properly, it should return a VoiceXML form to collect the user’s baseball request.
The alternative to method="GET" is method="POST". The difference is basically how the data gets to the server. With POST, the data is hidden placed after the HTTP header. With GET, the data is included as part of the URL, as in the following:
http://www.myserver.com/servlet/login?phone_number=2123456789&pin=1234
While most web servers can handle GET or POST requests equally well, using GET your VoiceXML applications opens up a useful debug and test option for you. In our example, we used the submit element to send both the phone_number and the pin_code to a server, expecting back a new VoiceXML document. Since the servlet is set up to respond to this input wherever it comes from on the Web, you can easily test your application by simply entering the above line into your favorite browser and check the output. Since the output will be VoiceXML (and not HTML), what you’ll see in the browser will vary from browser to browser, but if you select show page source, you’ll be able to see whatever the server generated in response to the Http GET request. This tip can save you considerable time when trying to debug server output by listening to your voice server.