title: XML response error: Invalid at the top level of the document
body: <p>I am getting an error back and following the API manual I received on how to encode my request. Below is my request..</p>
  
  <pre><code>string url = "[My url to send request to]";
  
  string xmlrequest = "&lt;serv_request&gt;&lt;head&gt;&lt;securityContext&gt;&lt;account&gt;[account]&lt;/account&gt;&lt;key&gt;[my account key]&lt;/key&gt;&lt;/securityContext&gt;&lt;/head&gt;&lt;body&gt;&lt;username&gt;[my user name]&lt;/username&gt;&lt;/body&gt;&lt;/serv_request&gt;";
  
  NameValueCollection nvc = new NameValueCollection();
  nvc.Add("xml", Server.UrlEncode(xmlrequest));
  
  
  WebClient client = new WebClient();
  
  byte[] byteresponse = client.UploadValues(url, nvc);
  
  string xmlresponse = client.Encoding.GetString(byteresponse);
  </code></pre>
  
  <p>I am getting a response back with the error. Invalid at the top level of document.</p>
  
  <p>Edit.. Adding the Instructions from the API Manual provided to me..  </p>
  
  <pre><code>string url = " http://[domain_name]/_gateway/api/[filename].asp"; 
  
  // formulate the XML request here 
  
  string xmlrequest = "&lt;serv_request&gt;...&lt;/serv_request&gt;";  
  
  NameValueCollection nvc = new NameValueCollection(); 
  nvc.Add("xml", Server.UrlEncode(xmlrequest)); 
  
  WebClient client = new WebClient(); 
  byte[] byteresponse = client.UploadValues(url, nvc); 
  
  string xmlresponse = client.Encoding.GetString(byteresponse); 
  </code></pre>