I have a webservice method defined as so:
[WebMethod]
public DataTable GetResponseCodeTypes()
{
// connect to database and retrieve results,
// then populate and return a DataTable
}
The method has been verified via the webservice test form and returns a DataTable
as expected:
<?xml version="1.0" encoding="utf-8"?>
<DataTable xmlns="http://tempuri.org/">
<DocumentElement xmlns="">
<ResponseCodeTypes>
<CodeTypeId>1</CodeTypeId>
<Descrip>RPC</Descrip>
</ResponseCodeTypes>
<ResponseCodeTypes>
<CodeTypeId>2</CodeTypeId>
<Descrip>Non-RPC</Descrip>
</ResponseCodeTypes>
<ResponseCodeTypes>
<CodeTypeId>3</CodeTypeId>
<Descrip>No connect</Descrip>
</ResponseCodeTypes>
</DocumentElement>
</DataTable>
However, when I call the GetResponseCodeTypes
method from my C# frontend code, not only does it return a DataSet
instead of a DataTable
, but the returned DataSet
contains zero tables.
I then went and modified the stub class (generated by Visual Studio when a web reference is added) to return a DataTable
instead. This works, inasmuch as I do get a DataTable
back - but said DataTable
has no columns or rows defined.
I know in .NET 1.x it was not possible to return a DataTable
from a webservice method (you had to wrap it in a DataSet
) but I was under the impression that this was fixed in .NET 2.x...
What is the issue here?
EDIT:
The webservice is .NET 2.0, running on a Linux box under Mono 2.4.2.3; while the frontend code is being developed in .NET 2.0 on a Windows XP machine running VS2008 with SP1.