1) Problems using an XML Web service that returns a DataTable
When you browse to the URL of an XML Web service that returns a DataTable from one of its Web methods, you may receive the following error message:
System.Data.DataRelation cannot be serialized
    because it does not have a default public constructor. 
Internal Server Error.
    Unable to request "http://localhost/Webservice1/Service1.asmx?WSDL". The server
    responded with error code "ProtocolError". 
System.NotSupportedException:
 Cannot serialize member 
System.ComponentModel.MarshalByValueComponent.Site of type 
System.ComponentModel.ISite because it is an interface.
The DataTable, DataRow, DataView, and DataViewManager objects cannot be serialized and cannot be returned from an XML Web service. To return less than a complete DataSet, you must copy the data that you want to return to a new DataSet.
Solution :
To resolve this issue, return a DataSet instead of a DataTable. DataSet objects can contain one or more DataTable objects.
No comments:
Post a Comment