A System.InvalidOperationException exception may occur when you try to use a Visual Studio .NET 2003 client application against a SQL Server 2005 native Web service (907886)



The information in this article applies to:

  • Microsoft SQL Server 2005 Standard Edition
  • Microsoft SQL Server 2005 Developer Edition
  • Microsoft SQL Server 2005 Enterprise Edition
  • Microsoft Visual Studio .NET (2003), Professional Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2003), Academic Edition

SYMPTOMS

When you try to use a Microsoft Visual Studio .NET 2003 client application against a Microsoft SQL Server 2005 native Web service, a System.InvalidOperationException exception may occur.

CAUSE

This problem occurs because the System.Data.DataSet object that Visual Studio .NET 2003 uses does not support the XML Schema definition language (XSD) schemas that SQL Server 2005 generates.

WORKAROUND

To work around this problem, use the simple Web Services Description Language (WSDL) instead of the default WSDL. For example, use a URL that is similar to the following URL:

http://<server>/<endpoint>?wsdlsimple

MORE INFORMATION

When you use the default WSDL to communicate with a SQL Server 2005 native Web service, the response data type is defined as a DataSet object that contains the XML Schemas (XSD) that SQL Server 2005 generates. The DataSet object that Visual Studio .NET 2003 uses cannot parse the XML Schemas (XSD). Therefore, the application throws an exception.

When you use the simple WSDL to generate the stub class to communicate with a SQL Server 2005 native Web service, the response data type is defined as an array of XML that substitutes the XML Schema (XSD) data types for SQL Server 2005 system types. The application does not perform any additional parsing other than parsing the SOAP message into the array of XML.

Modification Type:MajorLast Reviewed:11/3/2005
Keywords:kbsql2005webdata kbtshoot kbprb KB907886 kbAudDeveloper