Debugging WS Eventing - Openwsman/openwsman GitHub Wiki

Debugging WS-Eventing

WS-Eventing is a complex beast because it does multiple CIM/XML calls internally

  1. Create an indication filter
  2. Create an indication handler
  3. Create a subscription, associating the filter with the handler

Example

[All examples are based on sfcb with the cmpi-base provider]

This call

wsman subscribe http://schemas.dmtf.org/wbem/wscim/1/* \
-x "SELECT * FROM CIM_ProcessIndication" \
-D "http://schemas.microsoft.com/wbem/wsman/1/WQL" \
-Z http://127.0.0.1:80/eventsink \
--namespace=root/cimv2 \
-r 600 \
-H 2 \
-h localhost -u wsman -p secret \
-G push \
–R

should respond with something like

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing">
  <s:Header>
    <wsa:To>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:To>
    <wsa:Action>http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse</wsa:Action>
    <wsa:RelatesTo>uuid:7aa93d58-e589-1589-8002-3da9f9201300</wsa:RelatesTo>
    <wsa:MessageID>uuid:7abb87b4-e589-1589-8130-3da9f9201300</wsa:MessageID>
  </s:Header>
  <s:Body>
    <wse:SubscribeResponse>
      <wse:SubscriptionManager>
        <wsa:Address>http://localhost:5985/wsman</wsa:Address>
        <wsa:ReferenceParameters>
          <wse:Identifier>uuid:7ab9ac70-e589-1589-812f-3da9f9201300</wse:Identifier>
        </wsa:ReferenceParameters>
      </wse:SubscriptionManager>
      <wse:Expires>PT600.000000S</wse:Expires>
    </wse:SubscribeResponse>
  </s:Body>
</s:Envelope>

This can be verified on the CIMOM level by checking for the respective instances

The filter can be checked with

wbemcli ein http://wsman:secret@localhost:5988/root/interop:CIM_IndicationFilter

and will appear as

localhost:5988/root/interop:CIM_IndicationFilter
  creationclassname="CIM_IndicationFilter"
  name="7ab9ac70-e589-1589-812f-3da9f9201300"
  systemcreationclassname="CIM_ComputerSystem"
  systemname="localhost.localdomain"

The handler can be checked with

wbemcli ein http://wsman:secret@localhost:5988/root/interop:CIM_IndicationHandlerCIMXML

and will appear as

localhost:5988/root/interop:CIM_IndicationHandlerCIMXML
  creationclassname="CIM_IndicationHandlerCIMXML"
  name="7ab9ac70-e589-1589-812f-3da9f9201300"
  systemcreationclassname="CIM_ComputerSystem"
  systemname="localhost.localdomain"

The subscription can be checked with

wbemcli ein http://wsman:secret@localhost:5988/root/interop:CIM_IndicationSubscription

and will appear as

localhost:5988/root/interop:CIM_IndicationSubscription
  filter=root/interop:cim_indicationfilter
    creationclassname="CIM_IndicationFilter"
    name="7ab9ac70-e589-1589-812f-3da9f9201300"
    systemcreationclassname="CIM_ComputerSystem"
    systemname="localhost.localdomain"
  handler=root/interop:cim_indicationhandlercimxml
    creationclassname="CIM_IndicationHandlerCIMXML"
    name="7ab9ac70-e589-1589-812f-3da9f9201300"
    systemcreationclassname="CIM_ComputerSystem"
    systemname="localhost.localdomain"

Note that filter, handler, and subscription will appear in the root/interop namespace, while the indication class (the one we SELECT in the filter expression) is in the root/cimv2 (see --namespace parameter to wsman) namespace:

wbemcli ecn http://wsman:secret@localhost:5988/root/cimv2:CIM_ProcessIndication

localhost:5988/root/cimv2:Linux_OperatingSystemIndication

Create an indication filter

The indication filter is an instance of root/interop:CIM_IndicationFilter and created with the following key values

SystemCreationClassName: CIM_ComputerSystem
SystemName: localhost.localdomain
CreationClassName: CIM_IndicationFilter
Name: <uuid>

and properties

Query: <-x parameter from wsman>
QueryLanguage: <WQL|CQL>
SourceNamespace: <--namspace parameter to wsman>

Note: is an internally create unique identifier

The full instance for the example given above is:

localhost:5988/root/interop:CIM_IndicationFilter
  SystemCreationClassName="CIM_ComputerSystem"
  SystemName="localhost.localdomain"
  CreationClassName="CIM_IndicationFilter"
  Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  Generation=
  ElementName=
  Description=
  Caption=
  InstanceID=
  TemplateVariable=
  QueryLanguage="WQL"
  Query="SELECT * FROM CIM_ProcessIndication"
  IndividualSubscriptionSupported=TRUE
  SourceNamespaces="root/cimv2"
  SourceNamespace="root/cimv2"
  Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  CreationClassName="CIM_IndicationFilter"
  SystemName="localhost.localdomain"
  SystemCreationClassName="CIM_ComputerSystem"

Create an indication handler

The indication handler is an instance of root/interop:CIM_IndicationHandlerCIMXML and created with the following key values

SystemCreationClassName: CIM_ComputerSystem
SystemName: localhost.localdomain
CreationClassName: CIM_IndicationHandlerCIMXML
Name: <uuid>

and properties

Destination: http://localhost:<port>/cimindicationlistener/<uuid>
PersistenceType: 2

Note: is an internally create unique identifier, identical to the one from CIM_IndicationFilter above. is the openwsman listening port

The full instance for the example given above is:

localhost:5988/root/interop:CIM_IndicationHandlerCIMXML
  SystemCreationClassName="CIM_ComputerSystem"
  SystemName="localhost.localdomain"
  CreationClassName="CIM_IndicationHandlerCIMXML"
  Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  Generation=
  ElementName=
  Description=
  Caption=
  InstanceID=
  Protocol=2
  OtherProtocol=
  OtherPersistenceType=
  PersistenceType=2
  Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  CreationClassName="CIM_IndicationHandlerCIMXML"
  SystemName="localhost.localdomain"
  SystemCreationClassName="CIM_ComputerSystem"
  Owner=
  Destination="http://localhost:5985/cimindicationlistener/d9faf5c6-e589-1589-825d-3da9f9201300"

Note: The Destination value points to the openwsman daemon which intercepts the indication from the CIMOM, rewrites it to a WS-Eventing indication, and sends it to the event sink (-Z parameter to wsman)

Create a subscription

The subscription is an instance of root/interop:CIM_IndicationSubscription and created with the following key values

Filter: <reference to root/interop:CIM_IndicationFilter created above>
Handler: <reference to root/interop:CIM_IndicationHandlerCIMXML created above>

and properties

OnFatalErrorPolicy: 2
SubscriptionState: 2
SubscriptionDuration: <datetime, if expiry value given>
RepeatNotificationPolicy: 2

The full instance for the example given above is:

localhost:5988/root/interop:CIM_IndicationSubscription
  Filter=root/interop:CIM_IndicationFilter
    SystemCreationClassName="CIM_ComputerSystem"
    SystemName="localhost.localdomain"
    CreationClassName="CIM_IndicationFilter"
    Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  Handler=root/interop:CIM_IndicationHandlerCIMXML
    SystemCreationClassName="CIM_ComputerSystem"
    SystemName="localhost.localdomain"
    CreationClassName="CIM_IndicationHandlerCIMXML"
    Name="d9faf5c6-e589-1589-825d-3da9f9201300"
  SubscriptionInfo=
  LastIndicationProductionDateTime=
  LastIndicationIdentifier=
  AlertOnStateChange=FALSE
  RepeatNotificationCount=
  RepeatNotificationGap=
  RepeatNotificationInterval=
  OtherRepeatNotificationPolicy=
  RepeatNotificationPolicy=2
  SubscriptionTimeRemaining=
  SubscriptionStartTime=20130904093537.246865+120
  SubscriptionDuration=600
  TimeOfLastStateChange=
  OtherSubscriptionState=
  SubscriptionState=2
  FailureTriggerTimeInterval=
  OtherOnFatalErrorPolicy=
  OnFatalErrorPolicy=2

Note: Filter (CIM_IndicationFilter) and Handler (CIM_ListenerDestination) are references

⚠️ **GitHub.com Fallback** ⚠️