We've Moved! Please visit our new and improved forum over at our new portal: https://portal.plumvoice.com/hc/en-us/community/topics

Consuming a web service

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Consuming a web service

Post by publicsafety »

I have created a web service on our intranet as a test to consume with the voice xml.

However, after trying several syntactical changes, I can't get away from the error of: "a serious error of error.badfetch has occured"

Does anyone have a good reference of syntax for consuming a web service?

Here is my code:

<?xml version="1.0" ?>
- <vxml version="2.0">
- <form>
- <field name="ibm" type="digits">
<prompt>Welcome. Please enter your i-b-m number,</prompt>
- <filled>
You entered
<value expr="ibm" />
.
<var name="NiceName" expr="'http://10.1.202.231/wsphonetest/svc.asm ... eIBMNumber'" />
<data name="domName" srcexpr="NiceName" namelist="ibm" method="post" />
your result
<value expr="domName" />
</filled>
</field>
</form>
</vxml>


The web service is supposed to return 'true' for an even number' and 'false' for an odd number. I have tested it directly and it works fine.

agfa
Posts: 40
Joined: Thu Jun 15, 2006 12:56 pm

Post by agfa »

I don't know if it helps but:

a) I notice you are passing a field as a parameter into your webservice. I had trouble with that approach and started to use <var>iables instead. Simply assign your field to the variable before passing to the webservice.
e.g.
<field name="f_ibm" type="digits">
...
<assign name="ibm" expr="f_ibm"/>

b) If that still doesn't work and you have access to the webservice source code, rebuild the function without a parameter just to check that the actual web function is being correctly accessed.

Regards

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Post by publicsafety »

Thanks for the suggestions.

I tried both and still get the same error.

So frustrating!

agfa
Posts: 40
Joined: Thu Jun 15, 2006 12:56 pm

Post by agfa »

Not too sure what to suggest I'm afraid
You tried:
<data name="domName" srcexpr="NiceName" method="post" /> already.

You are sure that the web-address contained in 'NiceName' is accessible from the Plum box? Can you access it from any computer in your office?
Also, did you ensure your webservice accepts HttpPost and HttpGet messages by including them in your web.config protocols?

Regards

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

tags need to be changed within IVR code

Post by support »

Looking at your IVR code, you have your <data> tag inside of a <field> tag when it is a form-level element (meaning it can only be used within a <form> tag). So, for an IVR example, you could try:

Code: Select all

 <?xml version="1.0"?>
<vxml version="2.0">

<form id="intro">

     <field name="ibm" type="digits">
     <filled>
          ..............
          <goto next="#data"/>
     </filled>
     </field>
</form>

<form id="data">
     <data name="domName" srcexpr="NiceName" namelist="ibm" 
     method="post" />
     <block>
          <!-- Here you could check the results of the data -->
     </block>
     ................
</form>
</vxml>
Hope this helps.

Regards,
Plum Support[/code]
Last edited by support on Fri Feb 19, 2010 5:29 pm, edited 3 times in total.

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Making progress.

Post by publicsafety »

Now I get as far as the 'Your Result' promt, but then I get:

error.semantic.ecmascript

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR code needed to replicate problem

Post by support »

Hi,

Could you post the IVR code that you have so far that's causing this IVR error? This kind of IVR error usually means there's a javascript error with an <assign> or <var> tag.

Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 5:29 pm, edited 3 times in total.

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Code update

Post by publicsafety »

Sure, here is my code update. I am now calling a web service that needs no parameters, and returns 'false' everytime it is called, just to debug the whole returned value thing.

<?xml version="1.0" ?>
<vxml version="2.0">
<form id="intro">
<field name="f_ibm" type="digits">

<prompt>Welcome To Off Duty Trak. Please enter your i-b-m number,</prompt>
<filled>
You entered
<value expr="f_ibm" />
<assign name="ibm" expr="f_ibm"/>
<goto next="#data" />
</filled>
</field>
</form>

<form id="data" >
<filled>
<var name="NiceName" expr="'http://10.1.202.231/wsphonetest/svc.asmx/ReturnBoolean'" />
<subdialog name="domName" srcexpr="NiceName" method="post" />
</filled>
<block>
your result
<value expr="domName" />
</block>

</form>
</vxml>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

tags need to be changed within IVR code

Post by support »

Hi,

When I test your updated IVR code, an error.badfetch is returned. Also, I noticed that you are putting your <subdialog> tag inside of a <filled> block when it should be placed inside of a <form> tag. Hope this fixes the IVR error. Feel free to send any updated IVR code if you are still getting IVR errors.

Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 5:30 pm, edited 3 times in total.

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Post by publicsafety »

Sorry, I was trying different tags to get past the error.

I changed the <subdialog> back to <data> and removed the <filled> block.

This again gives me the: error.semantic.ecmascript

<?xml version="1.0" ?>
<vxml version="2.0">
<form id="intro">
<field name="f_ibm" type="digits">

<prompt>Welcome To Off Duty Trak. Please enter your i-b-m number,</prompt>
<filled>
You entered
<value expr="f_ibm" />
<assign name="ibm" expr="f_ibm"/>
<goto next="#data" />
</filled>
</field>
</form>

<form id="data" >
<var name="NiceName" expr="'http://10.1.202.231/wsphonetest/svc.asmx/ReturnBoolean'" />
<data name="domName" srcexpr="NiceName" method="post" />
<block>
your result
<value expr="domName" />
</block>

</form>
</vxml>

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

updated IVR code

Post by support »

Hi,

Is the URL returning 'text' or XML? The URL must return XML data to the <data> tag for it to work the IVR application.

Regards,
Plum Support
Last edited by support on Wed Jan 13, 2010 1:59 pm, edited 2 times in total.

agfa
Posts: 40
Joined: Thu Jun 15, 2006 12:56 pm

Post by agfa »

I don't know if it helps, but you can return an XMLDocument type if you are developing in .NET. This means you don't have to write a physical XML document, just return it in memory.

Then, there is some sample javascript code given in the Plum Programmers Reference <data> tag for parsing and extracting the value you might want from the XML document.

Regards

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Post by publicsafety »

I resorted to the following, which is a word-for-word example from the documentation, but still get error.badfetch:

data.vxml:
<?xml version="1.0" ?>
<vxml version="2.1">
<form>
<data name="domStuff" src="datatag.xml" />
<block>
Hello <value expr="domstuff.documentElement.firstchild.toString()" />.
</block>

</form>
</vxml>

datatag.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<tagname>
World
</tagname>

'Datatag.xml' is in the same directory, but I tried putting the whole path as well just to see if made a difference.

Very frustrating, and support insists that the problem is on my end.

Anyone have an sample script of calling web services that I could try?

support
Posts: 3632
Joined: Mon Jun 02, 2003 3:47 pm
Location: Boston, MA
Contact:

IVR call log needed to determine cause of error.badfetch

Post by support »

Hello,

Please provide an example IVR call log. Without an IVR call log any number of things could be generating an error.badfetch. Also looking at your IVR code it is not "word-for-word" the same, the Javascript code has two case sensitive errors:

This code:

Code: Select all

Hello <value expr="domstuff.documentElement.firstchild.toString()" />.
Should be:

Code: Select all

Hello <value expr="domStuff.documentElement.firstChild.toString()" />.
Also, you mention that your file name is Datatag.xml but then use datatag.xml in the code. Is that a typo or are you using an IVR application server that is case insensitive? In any case please provide the IVR call log so that we can determine the cause of the error.badfetch.

Regards,
Plum Support
Last edited by support on Fri Feb 19, 2010 5:31 pm, edited 2 times in total.

publicsafety
Posts: 8
Joined: Thu Jul 19, 2007 3:13 pm

Call log

Post by publicsafety »

Thu 26 Jul 2007 11:43:14 AM EDT:

Call Start Event: ANII DNIS 0001 VURL /usr/local/plumvp/config/director.vxml
DocumentParser::FetchDocument()
DocumentParser::FetchDocument(/usr/local/plumvp/config/director.vxml)
Attempting to fetch file:///usr/local/plumvp/config/director.vxml
Click here to view saved VoiceXML script
VXI::var_element(name="ani" expr = "session.telephone.ani")
VXI::var_element(name="dnis" expr = "session.telephone.dnis")
VXI::var_element(name="id" expr = "session.id")
VXI::var_element(name="callee_type" expr = "session.telephone.callee_type")
http://10.1.201.64/voicexml/test.xml
DocumentParser::FetchDocument(http://10.1.201.64/voicexml/test.xml)
Attempting to fetch http://10.1.201.64/voicexml/test.xml
Click here to view saved VoiceXML script
Attempting to fetch http://10.1.201.64/voicexml/datatag.xml
Parse error in file "http://10.1.201.64/voicexml/datatag.xml", invalid XML
errno: 205 uri http://10.1.201.64/voicexml/datatag.xml
received event: error.badfetch
bargein set to true
INPUTMODES set to "DTMF VOICE"
Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
---------

A serious error of type
---------
bargein set to true
INPUTMODES set to "DTMF VOICE"
Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
---------
error.badfetch
---------


Thu 26 Jul 2007 11:43:15 AM EDT:

bargein set to true
INPUTMODES set to "DTMF VOICE"
Audio segment added to prompt queue from TTS text/plain;charset=wchar_t for:
---------
has occurred. Exiting.
---------
VXI::exit_element()
Newly queued prompts are now being played


Thu 26 Jul 2007 11:43:21 AM EDT:

Call End Event
Ending session
Ending Session On Channel 0

Post Reply