title: Valid XML for posting to QuickBooks Online Edition - Receiving (400) Bad Request Error
body: <p>I am trying to post the below xml to <a href="https://apps.quickbooks.com/j/AppGateway" rel="nofollow noreferrer">https://apps.quickbooks.com/j/AppGateway</a> and all I keep getting is the error: The remote server returned an error: (400) Bad Request.  Does anyone have any ideas what I am doing wrong?  See below for the C# code that I am using to post the xml.</p>
  
  <p>Thanks,
  -Jeff</p>
  
  <p>UPDATE: To add more to my question, I am thinking that the (400) Bad Request error is indicating that I have something grossly wrong with the xml or with the way I am posting the xml.  So that is why I am asking this question... what am I missing here?</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;?qbxml version="7.0"?&gt;
  &lt;QBXML&gt;
  &lt;SignonMsgsRq&gt;
  &lt;SignonDesktopRq&gt;
  &lt;ClientDateTime&gt;7/20/2009 12:36PM&lt;/ClientDateTime&gt;
  &lt;ApplicationLogin&gt;APP_LOGIN&lt;/ApplicationLogin&gt;
  &lt;ConnectionTicket&gt;CONNECTION_TICKET&lt;/ConnectionTicket&gt;
  &lt;Language&gt;English&lt;/Language&gt;
  &lt;AppID&gt;APP_ID&lt;/AppID&gt;
  &lt;AppVer&gt;1&lt;/AppVer&gt;
  &lt;/SignonDesktopRq&gt;
  &lt;/SignonMsgsRq&gt;
  &lt;QBXMLMsgsRq&gt;
  &lt;CustomerQueryRq requestID="2" /&gt;
  &lt;/QBXMLMsgsRq&gt;
  &lt;/QBXML&gt;
  
  
  
  WebRequestObject = (HttpWebRequest)WebRequest.Create(requestUrl);
  WebRequestObject.Method = "POST";
  WebRequestObject.ContentType = "application/x-qbxml";
  WebRequestObject.AllowAutoRedirect = false;
  string post = XmlText.Text;
  
  WebRequestObject.ContentLength = post.Length;
  
  swr = new StreamWriter(WebRequestObject.GetRequestStream());
  swr.Write(post);
  swr.Close();
  
  WebResponseObject = (HttpWebResponse)WebRequestObject.GetResponse();
  </code></pre>