sqloptions:clientInterface 标头元素

sqloptions:clientInterface 登录选项使客户端能够指定用于登录的客户端界面,例如:

<SOAP-ENV:Header
  xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:clientInterface
          SOAP-ENV:mustUnderstand="1"
          value="name of client interface to use for login" />

</SOAP-ENV:Header>

sqloptions:clientInterface 登录选项显示为 SOAP 标头。它由一个名为 sqloptions:clientInterface 的元素构成。该元素有一个必需的属性 value(它是一个文本值)。此选项给出了为登录设置的客户端界面。这将显示在 sys.dm_exec_sessions 兼容视图的 client_interface_name 列中。

在请求中只能显示一个 sqloptions:clientInterface 选项实例。该选项无法在响应中显示。多个选项实例将会生成错误。

服务器可能会限制 sqloptions:clientInterface 值可以识别的值的范围。如果客户端提交的值超出了允许的范围,则服务器将自行截断该值,截断方式不定。

如果使用 SOAP 会话,则必须在与 sqloptions:sqlsession initiate 属性相同的请求中显示此选项。如果在任何带有 sqloptions:sqlSession 标头但不包含 initiate 属性的请求中显示此选项,则将生成错误。

以下是 sqloptions:clientInterface 选项的架构片段:

<xs:element name="clientInterface" form="qualified">
    <xs:annotation>
        <xs:documentation>
            Set the client interface for the login.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:attribute use="required" name="value" type="xs:string" form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The client interface to set for the login.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:element>

示例

以下是在 SOAP 请求和响应消息中使用 sqloptions:clientInterface 标头的示例。

请求

<SOAP-ENV:Envelope xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:sql="https://schemas.microsoft.com/sqlserver/2004/SOAP"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:sqlparam="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlParameter"
                   xmlns:sqlsoaptypes="https://schemas.microsoft.com/sqlserver/2004/SOAP/types"
                   xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
  <SOAP-ENV:Header>
    <sqloptions:clientInterface SOAP-ENV:mustUnderstand="1" value="ADO.Net SOAP 2.1" />
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <sql:sqlbatch>
      <sql:BatchCommands>
          SELECT client_interface_name FROM sys.dm_exec_sessions 
          WHERE session_id=@@spid AND client_interface_name='ADO.Net SOAP 2.1'
      </sql:BatchCommands>
    </sql:sqlbatch>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

响应

<SOAP-ENV:Envelope xml:space="preserve" 
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                   xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/" 
                   xmlns:sql="https://schemas.microsoft.com/sqlserver/2004/SOAP" 
                   xmlns:sqlsoaptypes="https://schemas.microsoft.com/sqlserver/2004/SOAP/types" 
                   xmlns:sqlrowcount="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlRowCount" 
                   xmlns:sqlmessage="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlMessage" 
                   xmlns:sqlresultstream="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlResultStream" 
                   xmlns:sqltransaction="https://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlTransaction" 
                   xmlns:sqltypes="https://schemas.microsoft.com/sqlserver/2004/sqltypes">
  <SOAP-ENV:Body>
    <sql:sqlbatchResponse>
      <sql:sqlbatchResult>
        <sqlresultstream:SqlRowSet xsi:type="sqlsoaptypes:SqlRowSet">
          <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
            <SqlRowSet1 xmlns="urn:schemas-microsoft-com:sql:SqlRowSet1">
              <row>
                <client_interface_name>ADO.Net SOAP 2.1</client_interface_name>
              </row>
            </SqlRowSet1>
          </diffgr:diffgram>
        </sqlresultstream:SqlRowSet>
        <sqlresultstream:SqlRowCount xsi:type="sqlrowcount:SqlRowCount">
          <sqlrowcount:Count>1</sqlrowcount:Count>
        </sqlresultstream:SqlRowCount>
      </sql:sqlbatchResult>
    </sql:sqlbatchResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

请参阅

参考

SOAP 扩展标头

帮助和信息

获取 SQL Server 2005 帮助