When you create the Web service proxy that uses Typed DataSet, the Typed DataSet does not correctly import secondary schemas. Instead of using the expected secondary schema, the returned schema imports a schema with an arbitrary name such as _app1.xsd. Because of an incorrect secondary schema name, the tools such as WSDL.exe or Microsoft Visual Studio .NET cannot correctly create a proxy for the Web service. Also, the returned XML cannot be serialized back to a corresponding Typed DataSet instance. If you try to do this, the result is an XmlSchemaException. To work around this problem, return the Typed DataSet that you want as an XmlElement in your WebMethod. In your client, you can explicitly load the returned XML to an instance of the Typed DataSet that you want. The following code is an example for WebMethod: [WebMethod] public System.Xml.XmlElement GetTypedDataSet () { // Create an instance of Typed DataSet. MyTypedDataSet myDs = new MyTypedDataSet ();
// Add some data to the DataSet. System.Data.SqlClient.SqlConnection myCn =new System.Data.SqlClient.SqlConnection("Persist Security Info=False;User ID=<username>;Password=<password>;Initial Catalog=pubs;Data Source=SQLServer;Packet Size=4096"); myCn.Open(); System.Data.SqlClient.SqlDataAdapter myDa = new System.Data.SqlClient.SqlDataAdapter("Select * from Employee", myCn); myDa.Fill(myDs, myDs.Tables[1].TableName);
// Return the DataSet as an XmlElement. System.Xml.XmlDataDocument xdd = new System.Xml.XmlDataDocument (myDs); System.Xml.XmlElement docElem = xdd.DocumentElement; return docElem ; } If you still not clear with this.. please see the following URL. I hope, this will solve ur problem thanx, Smith |