Share via


Default WSDL

The default WSDL is returned when the argument string wsdl is passed to an HTTP SOAP endpoint that is running on an instance of SQL Server 2005; for example: http://MyServer/MyEndpoint/sql?wsdl.

For default WSDL documents, the parameter elements contain type mappings from the WSDL sqltypes:type mappings to SQL Server 2005 system data types. For information about these mappings, see Data Type Mappings in Native XML Web Services.

The default WSDL document generated by an endpoint specifies parameter type by referencing one of the types defined in Data Type Mappings or by referencing subtypes of those types, and then additionally adding restrictions. For all string and binary types, the default WSDL returned by the endpoint will include a subtype that includes the XSD maxLength facet for specifying number of bytes or characters.

The maxLength facet is not generated for variable-length types that are declared with the (max) specifier. For decimal and numeric data types, the default WSDL will generate a subtype that includes the XSD totalDigits and fractionDigits facets that will describe the precision and scale of the parameter.

SQL Server to Common Language Runtime Type Mappings for Default WSDL

Default WSDL instances include support for mapping SQL Server data types to common language runtime (CLR) types that are provided in the Microsoft .NET Framework 2.0. Because some built-in CLR data types do not align well with SQL Server data types, the System.Data.SqlTypes namespace is provided in the .NET Framework 2.0. This enables a managed type system that could specifically handle many of the facets of the SQL Server 2005 data type system that otherwise cannot be mapped within XSD types.

For the .NET Framework 2.0 release, the Web Services Definition Language Tool (Wsdl.exe) has built-in support for generating the appropriate SQL Server to CLR type mappings for default WSDL instances. This support is available whether you are using Wsdl.exe at the command prompt or by way of adding a Web Reference to a Visual Studio 2005 project.

In the WSDL instances that are generated by using this type mapping support, all SQL Server data types are encoded by declaring and using a specific namespace URI (https://schemas.microsoft.com/sqlserver/2004/sqltypes) and its corresponding prefix (sqltypes). The following table shows how **sqltype:**type mappings in WSDL instances generated through the Wsdl.exe tool to map to their corresponding CLR types.

WSDL type element CLR type

sqltypes:char

System.Data.SqlTypes.SqlString

sqltypes:nchar

System.Data.SqlTypes.SqlString

sqltypes:varchar

System.Data.SqlTypes.SqlString

sqltypes:nvarchar

System.Data.SqlTypes.SqlString

sqltypes:text

System.Data.SqlTypes.SqlString

sqltypes:ntext

System.Data.SqlTypes.SqlString

sqltypes:varbinary

System.Data.SqlTypes.SqlBinary

sqltypes:binary

System.Data.SqlTypes.SqlBinary

sqltypes:image

System.Data.SqlTypes.SqlBinary

sqltypes:timestamp

System.Byte[]

sqltypes:timestampNumeric

System.Int64

sqltypes:decimal

System.Data.SqlTypes.SqlDecimal

sqltypes:numeric

System.Data.SqlTypes.SqlDecimal

sqltypes:bigint

System.Data.SqlTypes.SqlInt64

sqltypes:int

System.Data.SqlTypes.SqlInt32

sqltypes:smallint

System.Data.SqlTypes.SqlInt16

sqltypes:tinyint

System.Data.SqlTypes.SqlByte

sqltypes:bit

System.Data.SqlTypes.SqlBoolean

sqltypes:float

System.Data.SqlTypes.SqlDouble

sqltypes:real

System.Data.SqlTypes.SqlSingle

sqltypes:datetime

System.Data.SqlTypes.SqlDateTime

sqltypes:smalldatetime

System.Data.SqlTypes.SqlDateTime

sqltypes:money

System.Data.SqlTypes.SqlMoney

sqltypes:smallmoney

System.Data.SqlTypes.SqlMoney

sqltypes:uniqueidentifier

System.Data.SqlTypes.SqlGuid

sqltypes:xml

System.Xml.XmlNode[]1

sqltypes:sqlDbType="Sql_Variant"

System.Object

sqltypes:sqlDbType="Udt"

System.Xml.XmlElement2

1 Mapped to a class wrapper for an array of System.Xml.XmlNode objects. The wrapper class is named xml for untyped XML parameters, but uses a generated name for typed XML parameters.

2 Mapped to a wrapper class around a single System.Xml.XmlElement object that uses a generated name.

How the xml Data Type Is Handled in Default WSDL

When xml data type parameters are defined in the default WSDL, they are mapped to the sqltypes:xml WSDL data type. This allows for any well-formed XML to be specified without any additional content or schema-based validation. For more information, see xml Data Type

For xml data type parameters bound to an XML namespace, the default WSDL document will generate an <xsd:complexType> element that contains restrictions over the sqltypes:xml type. The typed XML in turn, specifies xsd:any type as the restriction rule. As shown in the following example, this restriction in turn will specify the processContents attribute setting its value to strict and will also specify the namespace attribute and set its value to a list of the corresponding XML namespaces associated with the schema collection to which the typed XML is bound.

<xsd:element name="xmlVal" minOccurs="1" maxOccurs="1" nillable="true">
    <xsd:complexType >
        <xsd:restriction base="sqltypes:xml">
             <xsd:any minOccurs="0" maxOccurs="unbounded" processContents="strict" namespace="NS1 NS2 ...." /> 
        </xsd:restriction>
    </xsd:complexType>
</xsd:element>

See Also

Reference

Simple WSDL
Implementing Custom WSDL Support

Concepts

Using WSDL

Help and Information

Getting SQL Server 2005 Assistance