次の方法で共有


sqloptions:notificationRequest ヘッダー要素

sqloptions:notificationRequest オプションを使用すると、クライアントが要求のきっかけとなるクエリ通知を指定できます。次に例を示します。

<SOAP-ENV:Header
  xmlns:SOAP-ENV="https://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="https://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:notificationRequest 
          SOAP-ENV:mustUnderstand="1"
          timeout="timeout value in seconds" 
          deliveryService="name of delivery service" />

</SOAP-ENV:Header>

sqloptions:notificationRequest オプションは SOAP ヘッダーとして指定します。ヘッダーは、sqloptions:notificationRequest という 1 つの要素で構成されています。この要素には、2 つの必須の属性 notificationIddeliveryService,、1 つの省略可能な属性 timeout があります。notificationIddeliveryService はどちらも text 型の値で、timeoutxsd:integer 型の値です。クエリ通知の sqloptions:notificationRequest オプションの使用方法の詳細については、「SOAP ヘッダーの使用によるクエリ通知のサブスクライブ」を参照してください。

sqloptions:notificationRequest オプションは 1 回の要求で 1 回のみ使用できます。このオプションを応答に使用することはできません。このオプションが複数存在するとエラーが発生します。

次に、スキーマの sqloptions:notificationRequest オプションに関する部分を示します。

<xs:element name="notificationRequest" form="qualified">
    <xs:annotation>
        <xs:documentation>
            Requests query notifications for the request.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:attribute
          use="required"
          name="notificationId"
          type="xs:string"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The notification identifier.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute
          use="required"
          name="deliveryService"
          type="xs:string"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The deliveryService.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="timeout" type="xs:integer" form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    The timeout value.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
    </xs:complexType>
</xs:element>

このヘッダーを指定すると、クエリ通知のサブスクリプションが要求されます。詳細については、「クエリ通知の使用」を参照してください。

次に、SOAP 要求メッセージと応答メッセージ内で sqloptions:notificationRequest ヘッダーを使用する例を示します。

要求

<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:notificationRequest notificationId="notification"
                                    timeout="1"
                                    deliveryService="deliveryService" >
    </sqloptions:notificationRequest>
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <sql:sqlbatch>
      <sql:BatchCommands></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>
      </sql:sqlbatchResult>
    </sql:sqlbatchResponse>
  </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

参照

関連項目

SOAP 拡張ヘッダー

ヘルプおよび情報

SQL Server 2005 の参考資料の入手