title: content not allowed in prolog exception
body: <p>I am trying to send xml to a java-based web service given to me by a third party via a c#.NET application, and I get the <code>org.xml.sax.SAXParseException: Content is not allowed in prolog</code> error. </p>
  
  <p>I have verified the xml against the schema, and I passed the memorystream I am using to hold the xml to an .xml file, then opened the file with a hex editor to make sure that there were no undesired characters in the prolog, and there are none. When opened, the first characters in the file are</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  </code></pre>
  
  <p>The class I was given to use to send the xml data to the web service accepts a byte array. I figure that creating the xml using an <em>XmlTextWriter</em> to a utf-8 encoded memorystream, then sending the contents of the stream to a byte array is the most direct method.</p>
  
  <p>I have done a lot of research and tried all the possbilities around this issue that I could find, but nothing works. Could someone please help? Thanks in advance.</p>
  
  <p>By the way, here is a portion of what the web service returns to me. In the payload of the SOAP message, should the data after the <strong></strong> element look like that, or be readable xml like the content before it?</p>
  
  <pre><code>Messages:
  Message:
  
  Payload: &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope xmlns:soap="http:/
  /schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema
  -instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body&gt;&lt;postSubmissi
  on xmlns="http://service.arm.hud.gov/"&gt;&lt;submissionHeader&gt;&lt;agcHcsId&gt;1&lt;/agcHcsId&gt;&lt;
  agcName&gt;test&lt;/agcName&gt;&lt;systemName&gt;123&lt;/systemName&gt;&lt;cmsSubId&gt;123456&lt;/cmsSubId&gt;&lt;su
  bFlag&gt;0&lt;/subFlag&gt;&lt;/submissionHeader&gt;&lt;agcType&gt;test&lt;/agcType&gt;&lt;submissionData&gt;PD94b
  WwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48dG5zOlN1Ym1pc3Npb25EYXRhIHhzaTpzY
  2hlbWFMb2NhdGlvbj0iaHR0cDovL2dvdi5odWQuYXJtL2FybV9kYXRhYmFnXzNfMS54c2QiIHhtbG5zO
  nhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxT......etc............................
  &lt;/submissionData&gt;&lt;/postSubmission&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  </code></pre>
  
  <p>Here the xml data for better readability:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;soap:Envelope xmlns:soap="http:/
      /schemas.xmlsoap.org/soap/envelope/"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema
      -instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
      &lt;soap:Body&gt;
          &lt;postSubmissi on xmlns="http://service.arm.hud.gov/"&gt;
              &lt;submissionHeader&gt;
                  &lt;agcHcsId&gt;1&lt;/agcHcsId&gt;
                  &lt;agcName&gt;test&lt;/agcName&gt;
                  &lt;systemName&gt;123&lt;/systemName&gt;
                  &lt;cmsSubId&gt;123456&lt;/cmsSubId&gt;
                  &lt;subFlag&gt;0&lt;/subFlag&gt;
              &lt;/submissionHeader&gt;
              &lt;agcType&gt;test&lt;/agcType&gt;
              &lt;submissionData&gt;PD94b
                  WwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48dG5zOlN1Ym1pc3Npb25EYXRhIHhzaTpzY
                  2hlbWFMb2NhdGlvbj0iaHR0cDovL2dvdi5odWQuYXJtL2FybV9kYXRhYmFnXzNfMS54c2QiIHhtbG5zO
                  nhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxT......etc............................
              &lt;/submissionData&gt;
          &lt;/postSubmission&gt;
      &lt;/soap:Body&gt;
  &lt;/soap:Envelope&gt;
  </code></pre>