title: Importing Sales Orders from Magento Using C# (salesOrderList function): "There is an error in XML document (2, 372)"
body: <p>Note: This question was originally part of <a href="https://stackoverflow.com/questions/8739640/magento-soap-api-v2-with-c-issue-with-stores-that-require-http-authentication">Magento SOAP API V2 with C#: Issue with Stores that Require HTTP Authentication </a> but I have moved a part of it here as a new question, as one part was already answered on that post.<br><br>
  ISSUE: 
  I have built a tool to import sales orders from customer stores (magento) for integration into our legacy order processing system.  I have five stores to import from.   Three work fine.  Two of them have the following problem:</p>
  
  <ul>
  <li><p>The following Exception is thrown upon executing the <code>salesOrderList()</code> call:</p>
  
  <blockquote>
    <p>A first chance exception of type 'System.InvalidOperationException' occurred in System.Xml.dll</p>
    
    <p>There is an error in XML document (2, 372).</p>
  </blockquote>
  
  <p>The login succeeds, I am able to enumerate attribute values, etc. 
  But I am unable to run the <code>salesOrderList()</code> function with any
  filter (and <code>null</code> too).  It would be great if someone has experience
  with this and can point me in the right direction, please.
  <br><br><br></p></li>
  </ul>
  
  <p><strong>Update:</strong> The invoking call is as follows:</p>
  
  <pre><code>salesOrderEntity[] soe = mservice.salesOrderList(mlogin, objSalesOrderFilterSet);
  </code></pre>
  
  <p>The Exception is, <em>There is an error in XML document (2, 372).</em><br>
  The InnerException is, <em>The specified type was not recognized: name='salesOrderListEntity', namespace='urn:Magento', at .</em> <br></p>
  
  <p><strong>Fiddler</strong> showed the following requested and returned for the salesOrderList() call:<br>
  Requested:<br></p>
  
  <pre><code>POST /api/v2_soap/index HTTP/1.1
  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.239)
  VsDebuggerCausalityData: uIDPoz6RG9JzwkdBniF95/gqmAcAAAAAhgJHnbvB1UOTE1y4R1Iq5VGLcSLUxTNDg57BO/4OizgACQAA
  Content-Type: text/xml; charset=utf-8
  SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction"
  Host: www.contoso.com
  Content-Length: 1753
  Expect: 100-continue
  </code></pre>
  
  <p>Returned:<br></p>
  
  <pre><code>    POST http://www.contoso.com/api/v2_soap/index HTTP/1.1
  User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.239)
  VsDebuggerCausalityData: uIDPoz6RG9JzwkdBniF95/gqmAcAAAAAhgJHnbvB1UOTE1y4R1Iq5VGLcSLUxTNDg57BO/4OizgACQAA
  Content-Type: text/xml; charset=utf-8
  SOAPAction: "urn:Mage_Api_Model_Server_V2_HandlerAction"
  Host: www.contoso.com
  Content-Length: 1753
  Expect: 100-continue
  
  &lt;?xml version="1.0" encoding="utf-8"?&gt;&lt;soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:Magento" xmlns:types="urn:Magento/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;&lt;soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;tns:salesOrderList&gt;&lt;sessionId xsi:type="xsd:string"&gt;2f9c5bdc898fd92c1f61981147ee5495&lt;/sessionId&gt;&lt;filters href="#id1" /&gt;&lt;/tns:salesOrderList&gt;&lt;tns:filters id="id1" xsi:type="tns:filters"&gt;&lt;complex_filter href="#id2" /&gt;&lt;/tns:filters&gt;&lt;soapenc:Array id="id2" soapenc:arrayType="tns:complexFilter[3]"&gt;&lt;Item href="#id3" /&gt;&lt;Item href="#id4" /&gt;&lt;Item href="#id5" /&gt;&lt;/soapenc:Array&gt;&lt;tns:complexFilter id="id3" xsi:type="tns:complexFilter"&gt;&lt;key xsi:type="xsd:string"&gt;created_at&lt;/key&gt;&lt;value href="#id6" /&gt;&lt;/tns:complexFilter&gt;&lt;tns:complexFilter id="id4" xsi:type="tns:complexFilter"&gt;&lt;key xsi:type="xsd:string"&gt;created_at&lt;/key&gt;&lt;value href="#id7" /&gt;&lt;/tns:complexFilter&gt;&lt;tns:complexFilter id="id5" xsi:type="tns:complexFilter"&gt;&lt;key xsi:type="xsd:string"&gt;status&lt;/key&gt;&lt;value href="#id8" /&gt;&lt;/tns:complexFilter&gt;&lt;tns:associativeEntity id="id6" xsi:type="tns:associativeEntity"&gt;&lt;key xsi:type="xsd:string"&gt;from&lt;/key&gt;&lt;value xsi:type="xsd:string"&gt;2011-12-28 00:00:00&lt;/value&gt;&lt;/tns:associativeEntity&gt;&lt;tns:associativeEntity id="id7" xsi:type="tns:associativeEntity"&gt;&lt;key xsi:type="xsd:string"&gt;to&lt;/key&gt;&lt;value xsi:type="xsd:string"&gt;2011-12-28 23:59:59&lt;/value&gt;&lt;/tns:associativeEntity&gt;&lt;tns:associativeEntity id="id8" xsi:type="tns:associativeEntity"&gt;&lt;key xsi:type="xsd:string"&gt;in&lt;/key&gt;&lt;value xsi:type="xsd:string"&gt;processing&lt;/value&gt;&lt;/tns:associativeEntity&gt;&lt;/soap:Body&gt;&lt;/soap:Envelope&gt;
  HTTP/1.1 200 OK
  Date: Thu, 05 Jan 2012 12:11:19 GMT
  Server: Apache/2.2.20 (Unix) mod_ssl/2.2.20 OpenSSL/1.0.0-fips mod_bwlimited/1.4 mod_fcgid/2.3.6
  X-Powered-By: PHP/5.3.6
  Content-Length: 6302
  Content-Type: text/xml; charset=UTF-8
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"&gt;&lt;SOAP-ENV:Body&gt;&lt;ns1:salesOrderListResponse&gt;&lt;result SOAP-ENC:arrayType="ns1:salesOrderListEntity[1]" xsi:type="ns1:salesOrderListEntityArray"&gt;&lt;item xsi:type="ns1:salesOrderListEntity"&gt;&lt;increment_id xsi:type="xsd:string"&gt;100001306&lt;/increment_id&gt;&lt;store_id 
  ...&lt;more data&gt;...
  xsi:type="xsd:string"&gt;John&lt;/firstname&gt;&lt;lastname xsi:type="xsd:string"&gt;Doe&lt;/lastname&gt;&lt;telephone xsi:type="xsd:string"&gt;999-999-9999 ext. 3333&lt;/telephone&gt;&lt;postcode xsi:type="xsd:string"&gt;11111&lt;/postcode&gt;&lt;/item&gt;&lt;/result&gt;&lt;/ns1:salesOrderListResponse&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;
  </code></pre>