Application Server Solutions for Microsoft IIS and ASP.NET
       solutions   products   partners   company   support   downloads         store
JTurbo Self-Help: FAQ
Back to Search >  Back to Search Results

Faq ID 273
Product BlueDragon
Category DataSource, Web Services
Question I'm trying to set up an ASP.NET page to return a Datatable to a CFML page as a web service. I get an error in the ASMX page. What's wrong?
Answer 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:
  • 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 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.

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):

<cfset table=emps.get_tables().get_Item("Authors")>
<cfoutput query="table">
...



   
company media information terms of use privacy policy contact us