M kapil
M kapil

Reputation: 21

Calling webservice from voice xml

How I can call webservice from voice xml (vxml) document. I am using an opensource IVR project and I need to run a webservice for any given option from within the vxml document.

This is similar to this query; how can I call a webservice from voiceXML? However, solution is provided there but it is not

Upvotes: 1

Views: 1175

Answers (2)

Moshe Yudkowsky
Moshe Yudkowsky

Reputation: 83

Your question is incomplete, but I suspect I know what's bothering you.

I get information from a webservice by using

<data name="return_data" srcexpr="some_url" method="post" namelist="var1 var2 var3" />

The data I get back is inside the return_data variable. In my case, the data are in XML format, and I use JavaScript functions to extract the data I need.

As an aside, for maintainability, re-usability, and ease of reading, I personally find it useful to create separate files for the JS functions and include them via <script> into my root VoiceXML document.

Upvotes: 1

Jim Rush
Jim Rush

Reputation: 4163

You cannot call a web service directly from a VoiceXML application. There are generally two approaches for getting data into a VoiceXML application:

  1. Use the data element tag to make an http request. The result must be XML. You will need to parse the result with the provided DOM functions. Note, some browsers have extended features to facilitate XML parsing. This also requires a VoiceXML 2.1 compliant browser.
  2. Transfer control to a dynamic bit of server code that returns VXML to be processed populating your desired variables. This can be done with a goto element or subdialog element.

Upvotes: 1

Related Questions