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

POST data to c# application

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

Post Reply
psomepalli
Posts: 6
Joined: Fri Aug 25, 2017 10:43 am

POST data to c# application

Post by psomepalli »

Hi ,

I am trying to POST a recorded voice to our C# application .
But I am getting below error. I tested this POST outside of the Plum using Google APP ARC and it works fine. Can you please help me on this? I have issues Posting a simple text too, Not just the recording .

Error Message
DocumentParser::FetchDocument - Parse error in file "http://fhivr.acryness.com/Home/SaveDetailedMessage", line 2, column 6 - Unknown element 'html'
errno: 205 uri http://fhivr.acryness.com/Home/SaveDetailedMessage

Scratch Pad:

<?xml version="1.0"?>
<vxml version="2.0">
<form>
<record name="messagetosave" beep="true">
<prompt>
Please record a message after the beep.
</prompt>
<filled>
<submit next="http://fhivr.acryness.com/Home/SaveDetailedMessage" method="post" namelist="
messagetosave" fetchtimeout="60s"/>
</filled>
</record>
</form>
</vxml>

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

Re: POST data to c# application

Post by support »

Hi,

It seems as though you are getting this error because the URL you are trying to POST to with the <submit> tag is not valid VXML, since it appears there is an <html> element in it. When you use the <submit> tag, after the POST is completed, the new document will be parsed and executed and the previous VXML document will be discarded. We would recommend you instead use the <subdialog> or <data> tag if you want your application to return to the page the tag was used on. The <data> tag may be more useful in your case since it will allow you to POST without using VXML in the URL you are POSTing to. You can find more information on the <data> tag here: https://www.plumvoice.com/docs/dev/voicexml:tags:data

Regards,
Plum Support

psomepalli
Posts: 6
Joined: Fri Aug 25, 2017 10:43 am

Re: POST data to c# application

Post by psomepalli »

I tried with data tag and gets a different error. That URL should be returning json back. But the call is not even reaching the server.
<form>
<field name="messagetosave" type="digits?length=1">
<prompt>
Enter a digit
</prompt>
<filled>
You entered <value expr="messagetosave"/>.
<data name="SaveInsurance" src="http://fhivr.acryness.com/Home/SaveDetailedMessage" accept="application/json" namelist="messagetosave" method="post" />
</filled>
</field>
</form>


Here is the error log:

ed 25 Oct 2017 03:33:56 PM EDT:
Posted form data is URL encoded
Attempting to fetch http://fhivr.acryness.com/Home/SaveDetailedMessage

Wed 25 Oct 2017 03:33:58 PM EDT:
Parse error in file "http://fhivr.acryness.com/Home/SaveDetailedMessage", invalid XML
errno: 205 uri http://fhivr.acryness.com/Home/SaveDetailedMessage
received event: error.badfetch:
bargein set to true
INPUTMODES set to "DTMF VOICE"
Audio segment added to prompt queue from TTS application/synthesis+ssml for:

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

Re: POST data to c# application

Post by support »

Hi,

It seems like we will need more information about your code to debug this issue. Would it be possible for you to either post the code used in SaveDetailedMessage here or PM it if you would prefer not to publish it?

Regards,
Plum Support

psomepalli
Posts: 6
Joined: Fri Aug 25, 2017 10:43 am

Re: POST data to c# application

Post by psomepalli »

This is just a simple test that I am doing to check the POST. GET is working as expected.It is not even logging the first log.

[ [HttpPost]
public ActionResult SaveDetailedMessage(string messagetosave)
{
this.Logger.InfoFormat("saving the Detailed Message");
string json = "{\"AuthorizationCode\":[\"" + -1 + "\"]}";
return Content(json, "application/json");

}

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

Re: POST data to c# application

Post by support »

Hi,

We tried to curl the URL you provided with the following command:

Code: Select all

curl -vv -dmessagetosave=6 http://fhivr.acryness.com/Home/SaveDetailedMessage
and we received a 301 redirect to https. When curling the same URL with https rather than http we saw the proper JSON returned.

Regards,
Plum Support

psomepalli
Posts: 6
Joined: Fri Aug 25, 2017 10:43 am

Re: POST data to c# application

Post by psomepalli »

Thank you. Yes, It worked when I used https instead of http now.
It solved my issue. But I am curious to know why the get is working with http and post with https

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

Re: POST data to c# application

Post by support »

Hi,

Your web server seems to allow HTTP access for GET requests while forcing a 301 redirect to HTTPS for POST requests. Unfortunately, why your server is requiring HTTPS for POST requests is something that only you would know or be able to control.

Regards,
Plum Support

psomepalli
Posts: 6
Joined: Fri Aug 25, 2017 10:43 am

Re: POST data to c# application

Post by psomepalli »

Thank You.

Post Reply