Export (0) Print
Expand All

sqloptions:environmentChangeNotifications Header Element

The sqloptions:environmentChangeNotifications SOAP header enables the client to specify which environment change notifications the client wishes to receive, for example:

<SOAP-ENV:Header
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:sqloptions="http://schemas.microsoft.com/sqlserver/2004/SOAP/Options">
    <sqloptions:environmentChangeNotifications  
         SOAP-ENV:mustUnderstand="1"
         databaseChange="true" | "false" 
         languageChange="true" | "false" 
         transactionBoundary="true" | "false"  />
</SOAP-ENV:Header>

The sqloptions:environmentChangeNotifications option appears as a SOAP header. The header is made up of one element, named sqloptions:environmentChangeNotifications. The element has four optional attributes: databaseChange, languageChange, partnerChange, and transactionBoundary; each of which is a Boolean value. The default value for all four is false. The optional attributes specify which notifications the client wants to receive.

Only one instance of the sqloptions:environmentChangeNotifications option can appear in a request. The option cannot appear in a response. Multiple instances of the option will generate an error, as will the existence of any content within the sqloptions:environmentChangeNotifications node.

If SOAP sessions are being used, this option must appear in the same request as the sqloptions:sqlsession initiate attribute. If this option appears in any request with a sqloptions:sqlSession header that does not also contain the initiate attribute, an error is generated.

The following is a schema fragment for the sqloptions:environmentChangeNotifications option:.

<xs:element name="environmentChangeNotifications" form="qualified">
    <xs:annotation>
        <xs:documentation>
            Receive environment change notifications.
        </xs:documentation>
    </xs:annotation>
    <xs:complexType>
        <xs:attribute
          name="databaseChange"
          default="false"
          type="xs:boolean"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    Receive notifications of database changes.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute
          name="languageChange"
          default="false"
          type="xs:boolean"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    Receive notifications of language changes.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute
          name="transactionBoundary"
          default="false"
          type="xs:boolean"
          form="unqualified">
            <xs:annotation>
                <xs:documentation>
                    Receive notifications of transaction boundaries.
                </xs:documentation>
            </xs:annotation>
        </xs:attribute>
        <xs:attribute name="partnerChange" default="false" type="xsd:boolean" form="unqualified">
            <xs:annotation>
                <xs:documentation>Receive notifications of partner changes.</xs:documentation> 
            </xs:annotation>
         </xs:attribute>
    </xs:complexType>
</xs:element>

The following are examples of using the sqloptions:environmentChangeNotifications header within SOAP request and response messages.

Request

POST !HTTPURL! HTTP/1.1
Content-Type: text/xml
Host: !SERVERNAME!
SOAPAction: "http://schemas.microsoft.com/sqlserver/2004/SOAPsqlbatch"
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                                        xmlns:sql="http://schemas.microsoft.com/sqlserver/2004/SOAP"
                                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                        xmlns:sqlparam="http://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlParameter"
                                        xmlns:sqlsoaptypes="http://schemas.microsoft.com/sqlserver/2004/SOAP/types"
                                        xmlns:sqloptions="http://schemas.microsoft.com/sqlserver/2004/SOAP/Options"
> 
  <SOAP-ENV:Header>
    <sqloptions:environmentChangeNotifications  
         SOAP-ENV:mustUnderstand="1"
         databaseChange="true" 
         languageChange="true" 
         transactionBoundary="true" />
  </SOAP-ENV:Header>
  <SOAP-ENV:Body>
    <sql:sqlbatch>
      <sql:BatchCommands>
         SET LANGUAGE Italian
         SELECT @@LANGUAGE as lang   
         USE  AdventureWorks
         BEGIN TRANSACTION testTransaction
         SELECT @@LANGUAGE as language
         COMMIT TRANSACTION testTransaction
       </sql:BatchCommands>
     </sql:sqlbatch>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Response

<Response>
  <Version>HTTP/1.1</Version>
  <Status>200</Status>
  <StatusText>OK</StatusText>
  <Headers>
    <Content-Type>text/xml; charset=utf-8</Content-Type>
    <Date>exists</Date>
    <Server>Microsoft-SQL/9.0 Microsoft-HTTPAPI/1.0</Server>
    <Transfer-Encoding>chunked</Transfer-Encoding>
  </Headers>
  <Body>
    <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="http://schemas.xmlsoap.org/soap/envelope/" 
                       xmlns:sql="http://schemas.microsoft.com/sqlserver/2004/SOAP" 
                       xmlns:sqlsoaptypes="http://schemas.microsoft.com/sqlserver/2004/SOAP/types" 
                       xmlns:sqlrowcount="http://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlRowCount" 
                       xmlns:sqlmessage="http://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlMessage" 
                       xmlns:sqlresultstream="http://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlResultStream" 
                       xmlns:sqltransaction="http://schemas.microsoft.com/sqlserver/2004/SOAP/types/SqlTransaction" 
                       xmlns:sqltypes="http://schemas.microsoft.com/sqlserver/2004/sqltypes">
      <SOAP-ENV:Body>
        <sql:sqlbatchResponse>
          <sql:sqlbatchResult>
            <sqlresultstream:SqlMessage xsi:type="sqlmessage:SqlMessage">
              <sqlmessage:Class>0</sqlmessage:Class>
              <sqlmessage:LineNumber>0</sqlmessage:LineNumber>
              <sqlmessage:Message>Changed language setting to Italiano.</sqlmessage:Message>
              <sqlmessage:Number>5703</sqlmessage:Number>
              <sqlmessage:Source>Microsoft-SQL/9.0</sqlmessage:Source>
              <sqlmessage:State>1</sqlmessage:State>
            </sqlresultstream:SqlMessage>
            <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>
                    <lang>Italiano</lang>
                  </row>
                </SqlRowSet1>
              </diffgr:diffgram>
            </sqlresultstream:SqlRowSet>
            <sqlresultstream:SqlRowCount xsi:type="sqlrowcount:SqlRowCount">
              <sqlrowcount:Count>1</sqlrowcount:Count>
            </sqlresultstream:SqlRowCount>
            <sqlresultstream:SqlMessage xsi:type="sqlmessage:SqlMessage">
              <sqlmessage:Class>0</sqlmessage:Class>
              <sqlmessage:LineNumber>0</sqlmessage:LineNumber>
              <sqlmessage:Message>Changed database context to 'Northwind'.</sqlmessage:Message>
              <sqlmessage:Number>5701</sqlmessage:Number>
              <sqlmessage:Source>Microsoft-SQL/9.0</sqlmessage:Source>
              <sqlmessage:State>1</sqlmessage:State>
            </sqlresultstream:SqlMessage>
            <sqlresultstream:SqlTransaction xsi:type="sqltransaction:SqlTransaction">
              <sqltransaction:Descriptor>asdf</sqltransaction:Descriptor>
              <sqltransaction:Type>Begin</sqltransaction:Type>
            </sqlresultstream:SqlTransaction>
            <sqlresultstream:SqlRowSet xsi:type="sqlsoaptypes:SqlRowSet">
              <diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1">
                <SqlRowSet2 xmlns="urn:schemas-microsoft-com:sql:SqlRowSet2">
                  <row>
                    <language>Italiano</language>
                  </row>
                </SqlRowSet2>
              </diffgr:diffgram>
            </sqlresultstream:SqlRowSet>
            <sqlresultstream:SqlRowCount xsi:type="sqlrowcount:SqlRowCount">
              <sqlrowcount:Count>1</sqlrowcount:Count>
            </sqlresultstream:SqlRowCount>
            <sqlresultstream:SqlTransaction xsi:type="sqltransaction:SqlTransaction">
              <sqltransaction:Descriptor>asdf</sqltransaction:Descriptor>
              <sqltransaction:Type>Commit</sqltransaction:Type>
            </sqlresultstream:SqlTransaction>
          </sql:sqlbatchResult>
        </sql:sqlbatchResponse>
      </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
  </Body>
</Response>

Community Additions

ADD
Show:
© 2014 Microsoft