POST data to c# application

Questions and answers about IVR programming for Plum DEV

Moderators: admin, support

  • Author
  • Message
Offline

psomepalli

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

POST data to c# application

PostWed Oct 18, 2017 10:48 am

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>
Offline

support

  • Posts: 3505
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: POST data to c# application

PostFri Oct 20, 2017 3:12 pm

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
Offline

psomepalli

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

Re: POST data to c# application

PostWed Oct 25, 2017 2:58 pm

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:
Offline

support

  • Posts: 3505
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: POST data to c# application

PostThu Oct 26, 2017 9:36 am

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
Offline

psomepalli

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

Re: POST data to c# application

PostThu Oct 26, 2017 10:46 am

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");

}
Offline

support

  • Posts: 3505
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: POST data to c# application

PostThu Oct 26, 2017 1:02 pm

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
Offline

psomepalli

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

Re: POST data to c# application

PostThu Oct 26, 2017 1:25 pm

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
Offline

support

  • Posts: 3505
  • Joined: Mon Jun 02, 2003 3:47 pm
  • Location: Boston, MA

Re: POST data to c# application

PostThu Oct 26, 2017 2:03 pm

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
Offline

psomepalli

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

Re: POST data to c# application

PostThu Oct 26, 2017 4:06 pm

Thank You.

Return to Plum DEV Q&A

Who is online

Users browsing this forum: No registered users and 1 guest

cron