user3390259
user3390259

Reputation: 21

Passing DataSet to WCF Service

I am new to .NET. I am trying to pass the DataSet following way to WCFService.

public static System.Data.DataSet ds = new System.Data.DataSet();
wscfservice.wcftestfunction(string1, string2, ref ds);

in WSDL file, the type defined

ActualType xmlns="http://schemas.microsoft.com/2003/10/Serialization/" Name="DataSet" Namespace="http://schemas.datacontract.org/2004/07/System.Data"

If I don't use ref, I am getting the compilation error. After running the program, I am getting a null value.

Here are error and ds descriptions

Channel Obtaining the runtime type of a transparent proxy is not supported in this context. 

Upvotes: 0

Views: 903

Answers (1)

Tim
Tim

Reputation: 28540

If you choose to (or must) use a DataSet, you need to set the Name property in order to ensure it serializes.

public static System.Data.DataSet ds = new System.Data.DataSet("MyDataSet");

From MSDN:

A name for the DataSet is required to ensure that the XML representation of the DataSet always has a name for the document element, which is the highest level element in a schema definition.

Upvotes: 1

Related Questions