Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 346929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T11:13:23+00:00 2026-05-12T11:13:23+00:00

First of all, I am a WEB NOOB. Which probably explains this question. Anyway,

  • 0

First of all, I am a WEB NOOB. Which probably explains this question. Anyway, when I use the web page test app to post xml to a url, everything works fine. Here is the pertinant code from the web page (i think):

<form action="/gateway/xml" method="post" id="xml-test-form">
  <textarea name="data">

  {some xml is in here}

  </textarea>
  <input type="submit" value="Submit Test" />
</form>

When I try to submit the exact same XML using C# (WebRequest or HttpWebRequest) with content type of (“text/xml” or “application/x-www-form-urlencoded”) with a buffer encoded (ASCII or UTF8) I get an error that implies the XML cant be read at all on the other end. Here is the error:

<?xml version="1.0"?>
<SubmitOrdersResponse>
  <status code="0">FAILURE</status>
  <errors>
    <error code="1001">Invalid XML Version</error>
  </errors>
</SubmitOrdersResponse>
<br /><b>Warning</b>:  DOMDocument::loadXML() [<a href='domdocument.loadxml'>domdocument.loadxml</a>]: Empty string supplied as input in <b>/var/www/vhosts/reports.gogetagrip.com/httpdocs/application/models/Gateway.php</b> on line <b>90</b><br />

I can reproduce this error using the web tester by removing a XML element named . I think this is the first element that is checked for, and hence the “INVALID XML VERSION” error. I think what is happening is my submittal is comming accross slighlty in the wrong format and that element can’t be read. I think specifically I have to simulate a posting data where my data is comming from the “data” form field (see above). I don’t know how to set that using the WebRequest class, so I can’t test it. Here is my code:

static private void Post(string sURL, string sXml) {
  try {
    //Our postvars
    byte[] buffer = Encoding.UTF8.GetBytes(sXml);  // Tried ASCII...same result
    HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(sURL);  // Tried WebRequest ... same result
    WebReq.Method = "POST";
    WebReq.ContentType = "application/x-www-form-urlencoded";  // tried "text/xml"... same result
    WebReq.ContentLength = buffer.Length;
    Stream ReqStream = WebReq.GetRequestStream();
    ReqStream.Write(buffer, 0, buffer.Length);
    ReqStream.Close();
    WebResponse WebRes = WebReq.GetResponse();
    //Console.WriteLine(WebResp.StatusCode);
    //Console.WriteLine(WebResp.Server);
    Stream ResStream = WebRes.GetResponseStream();
    StreamReader ResReader = new StreamReader(ResStream);
    string sResponse = ResReader.ReadToEnd();
  } catch (Exception ex) {

  } finally {

  }
}

Any Ideas?????

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T11:13:24+00:00Added an answer on May 12, 2026 at 11:13 am

    Yes, there is an easier way to do a Forms submit using System.Net… The WebClient class is your friend.

    In this case you would use webClient::UploadValues() and it will take care of everything else.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

first of all this is my third question about web services here and i
so this is question for 1mln$. First of all, I'm developing web application in
First, a bit of context: web.xml: I match all /app/* requests to my dispatcher:
First of all, I don't believe my question is a duplicate of this .
First of all, I am sorry if this question doesn't belong to SO since
First of all, let me apologize if this question is too broad. I'm looking
First of all, this is not a question about how to get the user's
First of all, my question is about HttpServer in Java to handle the POST
First of all I'd like to state that, despite the title, this question is
First of all, this is my third question on the similar topic.. and still

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.