Export (0) Print
Expand All

Contents of the WSDL File

SQL Server 2000

When you create a virtual name of soap type, you must also configure it. (For more information, see Initial Setup for Sending SOAP Requests.) The configuration process creates a Web Services Description Language (WSDL) file that identifies a list of stored procedures and templates that are available as part of the Microsoft® SQL Server™ XML Web service. A client can send SOAP requests for these operations to Microsoft SQLXML, which in turn, communicates with SQL Server, executes the operation, and returns the result of the operation as a SOAP response.

Web Services Description Language File

The Web Services Description Language (WSDL) file describes the service and the operations (stored procedures and templates) that are available in the service. The configuration process creates specific complex types to describe the data format in the SOAP input and output.

For example, the following WSDL fragment is common to all WSDL files that are created by the configuration process and defines the complex types. As you add stored procedures and templates to the configuration, these types are used to define the input and output parameters.

<?xml version="1.0"?>
<wsdl:definitions 
  name="soap" 
  targetNamespace="http://server/virtualroot/virtualname" 
  xmlns:tns="http://server/virtualroot/virtualname" 
 ...
 xmlns:sql="http://schemas.microsoft.com/SQLServer/2001/12/SOAP" 
  xmlns:sqltypes=
    "http://schemas.microsoft.com/SQLServer/2001/12/SOAP/types" 
  xmlns:sqlmessage=
    "http://schemas.microsoft.com/SQLServer/2001/12/SOAP/types/SqlMessage" 
  xmlns:sqlresultstream=
    "http://schemas.microsoft.com/SQLServer/2001/12/SOAP/
     types/SqlResultStream">
   
<wsdl:types>
    <xsd:schema ...
        <xsd:complexType name='SqlRowSet'>
          <xsd:attribute ref='sqltypes:IsNested'/>
           <xsd:sequence>
            <xsd:element ref='xsd:schema'/>
            <xsd:any/>
           </xsd:sequence>
        </xsd:complexType>

        <xsd:complexType name='SqlXml' mixed='true'>
         <xsd:sequence>
           <xsd:any/>
         </xsd:sequence>
        </xsd:complexType>

        <xsd:simpleType name='SqlResultCode'>
         <xsd:restriction base='xsd:int'>
           <xsd:minInclusive value='0'/>
         </xsd:restriction>
        </xsd:simpleType>

   </xsd:schema>

   <xsd:schema ...
      <xsd:complexType name='SqlMessage'>
        <xsd:attribute ref='sqltypes:IsNested'/>
        <xsd:sequence minOccurs='1' maxOccurs='1'>
          <xsd:element name='Class' 
                       type='sqltypes:nonNegativeInteger'/>
          <xsd:element name='LineNumber' 
                       type='sqltypes:nonNegativeInteger'/>
          <xsd:element name='Message' type='xsd:string'/>
          <xsd:element name='Number' type='sqltypes:nonNegativeInteger'/>
          <xsd:element name='Procedure' type='xsd:string'/>
          <xsd:element name='Server' type='xsd:string'/>
          <xsd:element name='Source' type='xsd:string'/>
          <xsd:element name='State' type='sqltypes:nonNegativeInteger'/>
        </xsd:sequence>
      </xsd:complexType>
   </xsd:schema>
The <types> element

All WSDL files created by the configuration process have a <types> element that defines these complex types:

  • SqlRowSet

    During configuration of the virtual name of soap type, if you specify that the method result be returned as a single DataSet object, the XML result is returned as an SqlRowSet type in the SOAP response. In Microsoft Visual Studio® .NET, this XML result is returned as a DataSet (System.Data.DataSet) object.

  • SqlXml

    During configuration of the virtual name of soap type, if you specify that the method result be returned as XML objects, the XML result is returned as an SqlXml type in the SOAP response for each SQL statement that is executed successfully. In Visual Studio .NET, this XML result is returned as an XmlElement (System.Xml.XmlElement) object in the object array.

  • SqlMessage

    If a stored procedure fails, SQL Server returns an error message(s). The error message is returned in the SOAP response as an SqlMessage type. In Visual Studio .NET, the error message in the SOAP response is returned as an SqlMessage type object in the object array.

  • SqlResultCode

    The return code for a stored procedure is returned as an SqlResultCode type in the SOAP response. In Visual Studio .NET, this XML result is returned as an SqlResultCode object in the object array with one exception. If you specify that the result is to be returned as a single DataSet object (not an object array) or if you are executing a UDF that is returning a simple-type value, the return code is returned as a separate <returnValue> element in the SOAP response. (In this case, in Visual Studio .NET, the return code is not returned in the object array but as a parameter of the method call.)

  • SqlResultStream

    When you add a stored procedure or a template to the configuration with its output set to XML objects or Dataset objects, the WSDL file defines an <OperationNameResult> element of SqlResultStream type for that operation. 

    This element includes the result of the operation. In the WSDL file, this type is defined to include zero or more elements of SqlXml, SqlMessage, SqlResultCode, or SqlRowset complex type.

    For example, if you execute a stored procedure that has three SQL statements, you could get zero or more SqlXml (or SqlRowSet) type elements that provide the XML results, and zero or more SqlMessage type elements that provide SQL Server error messages in the case of failure.

As you configure the virtual name and add stored procedures and templates to the configuration, the WSDL file is automatically updated to include these operations. See Sample Applications for Sending SOAP Requests for working samples and review the WSDL files that are generated for the samples.

Web Services (SOAP Support) Security Issues

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft