Guest Karl Kraus Report post Posted 01/06/2005 01:12 AM I need to have Voiceguide get a zipcode from the caller and pass it to a webservice then text to speech all of the responses. Karl Share this post Link to post
SupportTeam Report post Posted 01/06/2005 01:32 AM Pretty easy to do from within a 'Run VBScript' module. Can we access the webservice? Can you give us some examples of what the webservice would return? Share this post Link to post
Guest krauskarl Report post Posted 01/06/2005 01:44 AM Yes. Can you email me and I will give you the url where you can see the parms. Karl Share this post Link to post
Guest krauskarl Report post Posted 01/06/2005 03:01 AM krauskarl@hotmail.com Share this post Link to post
SupportTeam Report post Posted 01/06/2005 03:10 AM Email sent... (our email address is: support@voiceguide.com) Share this post Link to post
Guest Dave L Report post Posted 01/06/2005 03:58 PM Can you please publish example codes to do web services using 'Run VBScript' module? Thanks Share this post Link to post
SupportTeam Report post Posted 01/07/2005 05:50 AM Here is an example of how to retrieve information from a web service and return it to VoiceGuide. The example queries a (free) web service provided by ejse.com and retrieves the weather information for a particular ZIP code. In this example 22207 (Arlington, VA) was used. Returned data is then formatted as a Result Variable list and returned to VoiceGuide, when it may now be spoken to the caller or used for any further processing you may like. The demo now calls MsgBox function to show the user what was retrieved as well. You must have Microsoft's SOAP 3.0 Toolkit installed to use this. See: http://msdn.microsoft.com/webservices/down...ds/default.aspx The code below would go straight into a Run VBScript module: Set soapClient = CreateObject("MSSOAP.SoapClient30") soapClient.MSSoapInit "http://www.ejse.com/WeatherService/Service.asmx?WSDL" Set node_list = soapClient.GetWeatherInfo(22207) For Each node In node_list sText = sText & "[" & node.nodeName & "]{" & node.Text & "}" Next 'show user the returned information. 'comment out this line later. MsgBox sText set vg = CreateObject("VoiceGuide.CommandLink") vg.Run_ResultReturn $RV_LINEID, sText set vg = Nothing set soapClient = Nothing set node_list = Nothing an example of the Result Variable list returned: [Location]{Arlington, VA}[iconIndex]{26}[Temprature]{44°F}[FeelsLike]{41°F}[Forecast]{Cloudy}[Visibili y]{9.0 miles}[Pressure]{29.93 inches and rising}[DewPoint]{41°F}[uVIndex]{0 Low}[Humidity]{89%}[Wind]{From the North Northwest at 6 mph}[ReportedAt]{}[LastUpdated]{} So for example to say to the caller that wind is "From the North Northwest at 6 mph" you would just ask VoiceGuide to TTS the contents of $RV[Wind] And of course you can replace 22207 with a Result Variable which stores the ZIP code entered by the caller in some previous 'Get Numbers' module, or retrieved from a database etc etc... Share this post Link to post
Guest krauskarl Report post Posted 01/07/2005 05:58 AM Thank you so very much. I will try this out and let you know how it goes! Karl Share this post Link to post
SupportTeam Report post Posted 01/14/2005 09:00 AM If you do not want to use the SOAP toolkit then another approach to retrieve data from the above Web Service would be to just retrieve the contents returned by this URL: http://www.ejse.com/WeatherService/Service...o?zipCode=22207 and then just parse the returned XML to extract the required data. Similar approach would also work for all other Web Services. Share this post Link to post
JBeck Report post Posted 05/03/2005 01:53 AM I wanted to implement this by just parsing the XML. Feel free to use it anyone, it works well on my system. ' set xmlDoc=CreateObject("Microsoft.XMLDOM") ' Dim xDoc As MSXML.DOMDocument ' Dim Nodes As MSXML.IXMLDOMNodeList set vg = CreateObject("VoiceGuide.CommandLink") Dim MyTime MyTime = Time ' Return current system time. vg.RvSet $RV_LINEID, "SysTime", MyTime Set xDoc = CreateObject("MSXML2.DOMDocument") xDoc.async = False xDoc.validateOnParse = False If xDoc.Load("http://www.ejse.com/WeatherService/Service.asmx/GetWeatherInfo?zipCode=34236") Then ' The document loaded successfully. resultStr = "The temperature is currently " & _ left(xDoc.getElementsByTagName("Temprature").item(0).text,len(xDoc.getElementsByTagName("Temprature").item(0).text)-2) _ & ". Humidity is " & xDoc.getElementsByTagName("Humidity").item(0).text & _ ". The dew point is " & _ left(xDoc.getElementsByTagName("DewPoint").item(0).text,len(xDoc.getElementsByTagName("DewPoint").item(0).text)-2) _ & ". It feels like " & _ left(xDoc.getElementsByTagName("FeelsLike").item(0).text,len(xDoc.getElementsByTagName("FeelsLike").item(0).text)-2) _ & ". The wind is " & _ left(xDoc.getElementsByTagName("Wind").item(0).text,len(xDoc.getElementsByTagName("Wind").item(0).text)-3) _ & "miles per hour. Today's forecast is " & xDoc.getElementsByTagName("Forecast").item(0).text & "." vg.RvSet $RV_LINEID, "WeatherStr", resultStr vg.Run_ResultReturn $RV_LINEID, True Else ' The document failed to load. Set xPE = xDoc.parseError With xPE strErrText = "Your XML Document failed to load" & _ "due the following error." & vbCrLf & _ "Error #: " & .errorCode & ": " & xPE.reason & _ "Line #: " & .Line & vbCrLf & _ "Line Position: " & .linepos & vbCrLf & _ "Position In File: " & .filepos & vbCrLf & _ "Source Text: " & .srcText & vbCrLf & _ "Document URL: " & .url End With vg.RvSet $RV_LINEID, "WeatherStr", strErrText vg.Run_ResultReturn $RV_LINEID, False Set xPE = Nothing End If Set vg = Nothing Set xDoc = Nothing Set Nodes = Nothing Set MyTime = Nothing Just add a speak module and put $RV[WeatherStr] in the text-to-speak box. Have it play a music file while the script runs as I've found sometimes there's a delay, possibly from the www.ejse.com site. p.s. voiceguide rocks. Share this post Link to post
SupportTeam Report post Posted 05/03/2005 03:19 AM www.ejse.com does sometimes delay before returning information. It is easy to confirm where the delays are - just use a few Admin_TraceLogAdd() functions in your VBScript and then examine the VG Debug Trace. http://www.voiceguide.com/vghelp/html/com_...TraceLogAdd.htm Share this post Link to post