|If you receive any of the following errors .NET errors while trying to create/process a .NET web service (ASMX file), this FAQ applies to you:
The problem, of course, is not a CFML (or BlueDragon) error, since it's happening in the ASMX page (the asp.net web service page). It's due to an error in .NET where datatables cannot be returned in web service calls. Since we show examples of passing datatables between CFML and ASP.NET, this problem may become apparentto those doing experimentation with ASP.NET web services.
- System.NotSupportedException: Cannot serialize member System.ComponentModel.MarshalByValueComponent.Site of type System.ComponentModel.ISite because it is an interface.
- System.Data.DataRelation cannot be serialized because it does not have a default public constructor.
- Internal Server Error. Unable to request "http:///servicename.asmx?WSDL". The server responded with error code "ProtocolError".
- The document at the url http:///servicename.asmx was not recognized as a known document type.
The good news is that there is a Microsoft Technote explaining the problem. The bad news, again, is that you cannot pass a .NET datatable via a web service, because they are not themselves serializable. You can, however, return a dataset (containing the datatable). The technote shows very clear examples of how to solve the problem.
Their solution will indeed work. You just need to know how to grab a table out of the dataset, in order to process that in CFML.
If you use the example at the technote page, you could use the following CFML to obtain the "Authors" datatable within CFML (and of course, this would work for any code where the dataset contains a table, if you just name the proper table):