Freigeben über


sqloptions:clientPID (Header-Element)

Die Anmeldeoption sqloptions:clientPID ermöglicht es dem Client, die Clientprozess-ID für die Anmeldung anzugeben, z. B.:

<SOAP-ENV:Header
  xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:clientPID
          SOAP-ENV:mustUnderstand="1"
          value="ID of client process "/>

</SOAP-ENV:Header>

Die Anmeldeoption sqloptions:clientPID wird als SOAP-Header angezeigt. Er besteht aus einem Elemen namens sqloptions:clientPID. Das Element verfügt über ein obligatorisches Attribut: value. Dies ist ein langer ganzzahliger Wert (64-Bit-signiert). Das Attribut value gibt die Clientprozess-ID an, die für die Anmeldung festgelegt wird. Diese wird in der hostprocess-Spalte der Kompatibilitätssicht sys.sysprocesses angezeigt.

In einer Anforderung kann nur eine Instanz der Option sqloptions:clientPID angezeigt werden. Diese Option kann nicht in einer Antwort angezeigt werden. Mehrere Instanzen der Option verursachen einen Fehler.

Der Server kann evtl. den Bereich der anerkannten Werte für den Wert sqloptions:clientPID einschränken. Wenn ein Client einen Wert außerhalb des zulässigen Bereichs übermittelt, wird der Wert vom Server in einer nicht definierten Weise einfach abgeschnitten.

Wenn SOAP-Sitzungen verwendet werden, muss diese Option in derselben Anforderung wie das Attribut sqloptions:sqlsession initiate angezeigt werden. Wenn diese Option in irgendeiner Anforderung mit einem sqloptions:sqlSession-Header angezeigt wird, der nicht das Attribut initiate enthält, wird ein Fehler erzeugt.

Das folgende Schemenfragment gilt für die Option sqloptions:clientPID:

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

Beispiele:

Die folgenden Beispiele zeigen die Verwendung des sqloptions:clientPID-Headers innerhalb von SOAP-Anforderungs- und -Antwortmeldungen.

Anforderung

<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:clientPID SOAP-ENV:mustUnderstand="1" value="1234" />
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <sql:sqlbatch>
      <sql:BatchCommands>
        SELECT hostprocess FROM sysprocesses WHERE spid=@@spid AND hostprocess='1234'
      </sql:BatchCommands>
    </sql:sqlbatch>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Antwort

<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>
                <hostprocess>1234</hostprocess>
              </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>

Siehe auch

Verweis

SOAP-Erweiterungsheader

Hilfe und Informationen

Informationsquellen für SQL Server 2005