With the emergence of Web Services standards like SOAP, more and more enterprise applications expose unified interfaces. If you intend to voice enable a web service, or need to create an application that draws from Web Services as data repositories this article should provide helpful advice
The overall picture
The current release of the Angel.com platform has a general capability to exchange information via HTTP or HTTPS. Transaction pages offer a very straightforward model based on the following pattern:
- Collect information from callers or the call environment through Question and Voicemail pages
- For static playback, use standard Site Builder-created Voice Pages
- Whenever dynamic or runtime information needs to be played, use a Transaction Page.
- Transaction pages POST or GET to a URL. At that URL, a program can collect the parameters passed, formulate a query or implement some logic.
- The program returns AngelXML back, which Angel.com interprets as a Voice Page. If the response is valid, the AngelXML is played back to the caller.
With a Web Service, a 'presentation' or 'glue' layer is necessary to translate Angel HTTP POSTs to SOAP requests, and SOAP responses to AngelXML documents. This is normally a very thin layer, similar to what would be necessary to graphically render information in a web page that called on a Web Service.
Coding the presentation layer
Today most web platforms are well equiped with Web Services libraries. Some examples:
Rendering AngelXML should be simpler than generating HTML.
A typical pattern
When querying a web service, the following pattern is followed in the script:
- Get variables required, from HTTP request (coming from Angel) and from session (from previous requests)
- Form SOAP request, use the variables to fill the arguments.
- Invoke SOAP request
- Check for status
- If request failed, play simple AngelXML document stating a problem has occurred
- If request succeded but no data was returned, play AngelXML stating there is no match or similar, then branch to reprompt.
- If request succeded and data was returned, possibly instantiate an object to represent the data (e.g: a store location), then fill an AngelXML template and replace key values with variables from the object just created. If a collection of results was returned, possibly iterate and play it in sequence.
- Return AngelXML rendering to Angel.