0

I was wondering if I could get some help with this. A service is sending a POST request to my controller and I am trying to get the encoded URL so I can store the information in my database. Unfortnately I dont know exaclty what type of object it is I can use in order to refer to this encoded XML

This is the feed that is being sent by the service to my controller method:

POST https://localhost:44300/efile/GeneratingXMLFormResponse HTTP/1.1
Host: localhost:44300
Connection: keep-alive
Content-Length: 563
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: https://togatest.efiletexas.gov
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.125 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: https://togatest.efiletexas.gov/epayments/webs/EPaymentConfirmation.aspx
Accept-Encoding: gzip, deflate
Accept-Language: es,en-US;q=0.8,en;q=0.6
Cookie: _jsuid=1589536271; _okdetect=%7B%22token%22%3A%2214383525196380%22%2C%22proto%22%3A%22https%3A%22%2C%22host%22%3A%22localhost%3A44300%22%7D; _ok=9593-948-10-2895; .AspNet.ApplicationCookie=5vYkwGx8d4ALu7qNAHeDHrhm7VIfQXZ_xMqp8ns4Xt9UlklBWBcqjuRy_hv5hRtaTM8ZD08EXrvzusa4qooq_svaxPJC41PAx3mGPsLHR3cYbW0QpK0PNX5vNi0fNMlS7vKRcGDIpRjr2DSCBWY8XWBFihko2EBWxOdKrt-LK5-z6jauQrfrwWyGeHIsab9BHYr30iAfeOxrkvIVj9vguw7R6Gd9YPEpjgso3TdGc7tyQLv4FF0WB2dKzmv-5LkVIYp39QcGDyyXAJ79Z93JK1WYeF0flnI9gKYljyrvJaDfCFBBipanV2kY8h11RRqkPuI4KK3uXFjQbR4sh7zQHcCSLX37tAkwMLZUcVAm7V_KHPQhpEIH5F68tHivbE2zFk-uRq0_eASb9QMnxxIs8y2XL9ThRew4Z5DXToZrB4lUCFim0T1LGyOq7z5XvII-_N_jKic-M1X3O_pYN-heQWhwxlJN-QMEzdo7w4n_9t2PwL5Dzf9gtn01nqw2dV9oXAxhi_arkZ9vvjbe0WYYJg; _okac=5ad74dff9c0fd7f739a94f0c8e47f538; _okla=1; _okbk=cd5%3Davailable%2Ccd4%3Dtrue%2Cvi5%3D0%2Cvi4%3D1438875502265%2Cvi3%3Dactive%2Cvi2%3Dfalse%2Cvi1%3Dfalse%2Ccd8%3Dchat%2Ccd6%3D0%2Ccd3%3Dfalse%2Ccd2%3D0%2Ccd1%3D0%2C; heatmaps_g2g_100855693=no; _ga=GA1.1.845327345.1433349177; _gat=1; _oklv=1438876103374%2Ca8VFkRUOPj95wlmt5R2JW7AJFUNQE0Ib; calltrk_referrer=direct; calltrk_landing=https%3A//localhost%3A44300/Efile; calltrk_session_swap_numbers_215746334=5123841992%3D8775996483; clicky_olark=9593-948-10-2895,W23FqlSrwPRFNA555R2JW1Z3JUQ0EHN1,a8VFkRUOPj95wlmt5R2JW7AJFUNQE0Ib; _first_pageview=1; calltrk_session_id_215746334=acab75bc-fb76-4073-bc6a-1d4b5115975c; olfsk=olfsk03380024363286793; wcsid=a8VFkRUOPj95wlmt5R2JW7AJFUNQE0Ib; hblid=W23FqlSrwPRFNA555R2JW1Z3JUQ0EHN1

ResponseXML=%3CPaymentResponse%3E%3CClientKey%3ECJOFSTEXFILE%3C%2FClientKey%3E%3CTransactionID%3E44077405%3C%2FTransactionID%3E%3CAmount%3E-1.00%3C%2FAmount%3E%3CReferenceNumber%3E%3C%2FReferenceNumber%3E%3CPayorToken%3E54230445%3C%2FPayorToken%3E%3CPayorName%3EMarco+A+Lostaunau%3C%2FPayorName%3E%3CTenderDescription%3EDISCOVER+XXXXXXXXXXXX0000%3C%2FTenderDescription%3E%3CExpirationMonth%3E5%3C%2FExpirationMonth%3E%3CExpirationYear%3E2018%3C%2FExpirationYear%3E%3CPaymentTimestamp%3E8%2F6%2F2015+10%3A49%3A17+AM%3C%2FPaymentTimestamp%3E%3C%2FPaymentResponse%3E

As you can see the ResponseXML parameter is set to an encoded XML. I need to extract this information from this parameter decoded, deserialize it and take some of the nodes.

This is my controller method:

public ActionResult GeneratingXMLFormResponse(XmlDocument xmlResponse)
{
    var form = xmlResponse;

    return View("EfileView");
}

The xmlResponse does not have the information that I need.

What object can I use in order to refer to the parameter ResponseXML?

ataravati
  • 8,891
  • 9
  • 57
  • 89
Lostaunaum
  • 697
  • 1
  • 10
  • 31
  • you try FormCollection to see what the value looks like? Parameter name should probably be ResponseXML also.. – JamieD77 Aug 06 '15 at 18:21
  • @JamieD77 Hello Good Sir! Thank you for your reply. The form collection does return as value "ResponseXML" however the actual XML is not in it. – Lostaunaum Aug 06 '15 at 18:40
  • this you see this? http://stackoverflow.com/questions/1111874/how-to-pass-xml-as-post-to-an-actionresult-in-asp-mvc-net?answertab=votes#tab-top – JamieD77 Aug 06 '15 at 18:43
  • I only see "ResponseXML" set as a value.... :( – Lostaunaum Aug 06 '15 at 19:01

1 Answers1

0

Hey guys I figured out how to do this.

If your parameter and XML are coming in the body of your resposen you can receive it in your controller method as a string. After receiving the string you can transform that string into an XML like so:

        [HttpPost, ValidateInput(false)]
        public string GeneratingXMLFormResponse(string responseXML)
        {
            XmlDocument xml = new XmlDocument();

            xml.LoadXml(responseXML);
        }
Lostaunaum
  • 697
  • 1
  • 10
  • 31