sqloptions:hostname 헤더 요소

Microsoft SQL Server의 이후 버전에서는 이 기능이 제거됩니다. 새 개발 작업에서는 이 기능을 사용하지 않도록 하고, 현재 이 기능을 사용하는 응용 프로그램은 수정하십시오.

sqloptions:hostName 로그인 옵션을 사용하면 클라이언트가 로그인에 대한 호스트 이름을 지정할 수 있습니다. 예를 들면 다음과 같습니다.

<SOAP-ENV:Header
  xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:hostname           SOAP-ENV:mustUnderstand="1"          value="hostName"/>
    
</SOAP-ENV:Header>

sqloptions:hostName 로그인 옵션은 SOAP 헤더로 나타나며 sqloptions:hostName이라는 이름의 요소 하나로 구성됩니다. 이 요소에는 하나의 필수 특성인 value(텍스트 값)가 있습니다. 이 특성은 로그인에 설정할 host name을 부여합니다. 이것은 sys.sysprocesses 호환성 뷰의 hostname 열에 나타납니다.

sqloptions:hostName 옵션의 인스턴스 하나만 요청에 표시됩니다. 이 옵션은 응답에는 나타날 수 없습니다. 해당 옵션의 인스턴스가 여러 개 나타나면 오류가 발생합니다.

서버는 sqloptions:hostName 값에 대한 인식된 값의 범위를 제한할 수 있습니다. 클라이언트가 허용된 범위 밖의 값을 전송하면 서버에서 정의되지 않은 방식으로 해당 값을 자동으로 자릅니다.

SOAP 세션을 사용 중인 경우 이 옵션은 sqloptions:sqlsession initiate 특성과 같은 요청에 나타나야 합니다. initiate 특성이 포함되지 않은 sqloptions:sqlSession 헤더가 있는 요청에 이 옵션이 나타나면 오류가 발생합니다.

다음은 sqloptions:hostName에 대한 스키마의 일부분입니다.

<xs:element name="hostName" form="qualified">
    <xs:annotation>
        <xs:documentation>
            Set the host name 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 host name to set for the login.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:element>

다음은 SOAP 요청 및 응답 메시지 내에 sqloptions:hostname 헤더를 사용하는 예입니다.

요청

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

참고 항목

참조