title: Web service call: Unexpected end of file while parsing Name has occurred
body: <p>I created a web service (ASP.NET Web Service Application ,.NET framework 3.5) that accesses the database, retrieves the data and returns it to client as <strong>DataTable</strong> type.</p>
  
  <p>When I calling this web service from a client app I get the error message <strong>"There is an error in XML document (1, 36276)"</strong> with inner exception <strong>"Unexpected end of file while parsing Name has occurred. Line 1, position 36276."</strong></p>
  
  <p>I have tried to reduce the amount of data returned by the query (SELECT TOP 1) - error disappeared. But I need all my data :) (118 rows with 30 columns)</p>
  
  <p>I guess that the problem is that the web service response string does not fit the default serialization buffer (probably 4kb), and therefore there is "Unexpected end of file".</p>
  
  <p>How can I increase the length (or maybe type) of web service serialization buffer?</p>
  
  <p>Web service code:</p>
  
  <pre><code>[WebMethod]
  public DataTable GetTargetAchievement()
  {
      var dt = new DataTable("TableName");
  
      using (var conn = new SqlConnection(GetConnectionString()))
      {
          using (var da = new SqlDataAdapter("select * from [Table] ORDER BY 1,3,2; ", conn))
          {
              da.Fill(dt);
          }
      }
  
      return dt;
  }
  </code></pre>
  
  <p>Client (WPF) code:</p>
  
  <pre><code>private void btnCallService_Click(object sender, RoutedEventArgs e)
  {
      TAA.AuditService service = new TAA.AuditService();
      var dt = service.GetTargetAchievement();
  
      lbxList.ItemsSource = dt.DefaultView;
  }
  </code></pre>