Intel AMT Features > WS-Eventing > Use Cases > Un-Subscribe for Events
CollapseAll image

Un-Subscribe for Events

The following steps describe how to un-subscribe for events.

1.  Retrieve the instances of CIM_FilterCollection.

2.  To find the required subscription filter, look for an instance of CIM_FilterCollection where the “InstanceID” key equals the desired filter, for example “Intel(r) AMT:All” (see WS-Eventing Event Filters).

3.  From that instance of CIM_FilterCollection, traverse the instances of the CIM_FilterCollectionSubscription associations  to find the instance of CIM_ListenerDestinationWSManagement representing the subscriber that you want to un-subscribe. (The Destination property of CIM_ListenerDestinationWSManagement  contains the URL of the subscriber.)

4.  Invoke CIM_FilterCollectionSubscription.Unsubscribe on the instance you found in step 3.

Click here for a snippet demonstrating this step

You can execute this snippet by inserting it into the execution template found here.

  

$instanceID ="Intel(r) AMT:All" # The instance ID of the desired filter.

$destination ="192.168.0.0:5000"

# Create a reference to the CIM_FilterCollection instance

$filterCollectionRef =$wsmanConnectionObject.NewReference("SELECT * FROM CIM_FilterCollection WHERE InstanceID='" +$instanceID +"'")

$filterCollectionSubscriptionRef =$wsmanConnectionObject.NewReference("CIM_FilterCollectionSubscription")

$filterCollectionSubscriptionRef.AddSelector("Filter",$filterCollectionRef)

# Traverse to the CIM_ElementSettingData instances that are connected to the CIM_FilterCollection instance.

foreach($filterCollectionSubscriptionItem in$filterCollectionSubscriptionRef.Enumerate("http://schemas.dmtf.org/wbem/wsman/1/wsman/SelectorFilter",$null))

{

    $filterCollectionSubscriptionRef =$filterCollectionSubscriptionItem.Object.ToReference("Filter","Handler")

    $filterCollectionSubscriptionInstance =$filterCollectionSubscriptionRef.Get()

    # For each instance, check if it is associated to the CIM_ListenerDestinationWSManagement instance.

if($filterCollectionSubscriptionInstance.GetProperty("Handler").IsA("CIM_ListenerDestinationWSManagement"))

    {

          $listenerDestinationWSManagementInstance =$filterCollectionSubscriptionInstance.GetProperty("Handler").Ref.Get()

          if($listenerDestinationWSManagementInstance.GetProperty("Destination") -like $destination)

          {

                $filterCollectionSubscriptionRef.Unsubscribe()

          }

    }

}

 

 

Additional Information

The following example demonstrates a WS-Eventing un-subscription request in the XML format that the Intel AMT firmware expects to receive:

<soap:Envelope

    xmlns:soap=http://www.w3.org/2003/05/soap-envelope

    xmlns:tns="http://schemas.dmtf.org/wbem/wscim/1/cim-

      schema/2/CIM_FilterCollectionSubscription"  

    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"  

    xmlns:xsd="http://www.w3.org/2001/XMLSchema"

    xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"

    xmlns:wscat="http://schemas.xmlsoap.org/ws/2005/06/wsmancat"

    xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"

    xmlns:wxf="http://schemas.xmlsoap.org/ws/2004/09/transfer"

    xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common"

    xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration">

  <soap:Header>

    <-- This is the Intel AMT machine address -->

    <wsa:To> http://myAmtMachine:16992/wsman </wsa:To>

    <wsa:ReplyTo>

       <wsa:Address soap:mustUnderstand="true">

    http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous

       </wsa:Address>

    </wsa:ReplyTo>

    <wsa:Action soap:mustUnderstand="true">

    http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe

    </wsa:Action>

    <wsman:MaxEnvelopeSize soap:mustUnderstand="true">

    51200

    </wsman:MaxEnvelopeSize>

    <wsa:MessageID>

    uuid:54566854-1716-2808-5012-785038710670

    </wsa:MessageID>

    <wsman:ResourceURI soap:mustUnderstand="true">

    http://schemas.dmtf.org/wbem/wscim/1/cim-

      schema/2/CIM_FilterCollectionSubscription

    </wsman:ResourceURI>

    <wsman:SelectorSet>

      <wsman:Selector Name="Filter">

        <wsa:EndpointReference>

          <b:Address

      xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing">

        http://schemas.xmlsoap.org/ws/2004/08/addressing/role/

        anonymous

          </b:Address>

          <b:ReferenceParameters

       xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/addressing">

            <c:ResourceURI xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/

        wsman.xsd">

                http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/

          CIM_FilterCollection

            </c:ResourceURI>

            <c:SelectorSet xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/

               wsman.xsd">

              <c:Selector Name="InstanceID">

          <-- this is the CIM_FilterCollection ID -->

                Intel(r) AMT:All

              </c:Selector>

            </c:SelectorSet>

          </b:ReferenceParameters>

        </wsa:EndpointReference>

      </wsman:Selector>

      <wsman:Selector Name="Handler">

        <wsa:EndpointReference>

          <b:Address xmlns:b="http://schemas.xmlsoap.org/ws/2004/08/

       addressing">

            http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous

          </b:Address>

          <b:ReferenceParameters xmlns:b="http://schemas.xmlsoap.org/ws/

          2004/08/addressing">

            <c:ResourceURI xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/

          wsman.xsd">

          http://schemas.dmtf.org/wbem/wscim/1/cim-

            schema/2/CIM_ListenerDestinationWSManagement

            </c:ResourceURI>

            <c:SelectorSet xmlns:c="http://schemas.dmtf.org/wbem/wsman/1/

          wsman.xsd">

              <c:Selector Name="Name">

          <-- Name of CIM_ListenerDestinationWSManagement object. Must

              be read from the object created during subscription -->

                Listener Destination 0

              </c:Selector>

              <c:Selector Name="CreationClassName">

                     CIM_ListenerDestinationWSMAN

             </c:Selector>

              <c:Selector Name="SystemName">

                Intel(r) AMT

          </c:Selector>

              <c:Selector Name="SystemCreationClassName">

               CIM_ComputerSystem

              </c:Selector>

            </c:SelectorSet>

          </b:ReferenceParameters>

        </wsa:EndpointReference>

      </wsman:Selector>

    </wsman:SelectorSet>

    <wsman:OperationTimeout>

   PT60.000S

    </wsman:OperationTimeout>

  </soap:Header>

  <soap:Body />

</soap:Envelope>

 

Instance Diagram

Classes Used in This Flow

SDK Sample

If there is a sample demonstrating this flow, it is included in the SDK installation file. See SDK Installation Layout for details.

 

See Also:

   WS-Eventing Event Subscribers

   WS-Eventing Event Filters

   Additional Subscription Options

Copyright © 2006-2022, Intel Corporation. All rights reserved.