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 DataTable type.
When I calling this web service from a client app I get the error message "There is an error in XML document (1, 36276)" with inner exception "Unexpected end of file while parsing Name has occurred. Line 1, position 36276."
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)
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".
How can I increase the length (or maybe type) of web service serialization buffer?
Web service 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;
}
Client (WPF) code:
private void btnCallService_Click(object sender, RoutedEventArgs e)
{
TAA.AuditService service = new TAA.AuditService();
var dt = service.GetTargetAchievement();
lbxList.ItemsSource = dt.DefaultView;
}