Hi,
I create filter and handler successfully on sfcb by using sfcc. But it fails when trying creating subscription. CreateInstance() returns 7, which means that "No supported indication classes in filter query or no provider found". Anyone has any idea why this happens?
Below is my code. Many thanks.
void SfcbClient::createFilter()
{
        logger.info("enter createFilter");
        CMPIObjectPath * objectpath = NULL, * objectpath2 = NULL;
        CMPIInstance * instance = NULL;
        CMPIStatus status;

        objectpath = newCMPIObjectPath("root/interop", "CIM_IndicationFilter", NULL);
        CMAddKey(objectpath, "CreationClassName", "CIM_IndicationFilter", CMPI_chars);
        CMAddKey(objectpath, "SystemName", "localhost", CMPI_chars);
        CMAddKey(objectpath, "SystemCreationClassName", "CIM_ComputerSystem", CMPI_chars);
        CMAddKey(objectpath, "Name", "hpshd", CMPI_chars);
        CMAddKey(objectpath, "SourceNamespace", "root/interop", CMPI_chars);
        //CMAddKey(objectpath, "Query", "SELECT * FROM CIM_ProcessIndication", CMPI_chars);
        CMAddKey(objectpath, "Query", "SELECT * FROM CIM_OperatingSystem", CMPI_chars);
        CMAddKey(objectpath, "QueryLanguage", "WQL", CMPI_chars);

        instance = newCMPIInstance(objectpath, NULL);
        //CMSetProperty(instance, "Name", "hpshd", CMPI_chars);
        //CMSetProperty(instance, "Query", "SELECT * FROM CIM_ProcessIndication", CMPI_chars);
        //CMSetProperty(instance, "QueryLanguage", "WQL", CMPI_chars);

        objectpath2 = pclient->ft->createInstance(pclient, objectpath, instance, &status);
        filterPath = objectpath2;

        logger.info("createInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        if(status.rc == 11)
        {
                status = pclient->ft->deleteInstance(pclient, objectpath);
                logger.info("deleteInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        }
        //if (instance) CMRelease(instance);
        //if (objectpath) CMRelease(objectpath);
        //if (status.msg) CMRelease(status.msg);
        logger.info("exit createFilter");
}
void SfcbClient::createHandler()
{
        logger.info("enter createHandler");
        CMPIObjectPath * objectpath = NULL, * objectpath2 = NULL;
        CMPIInstance * instance = NULL;
        CMPIStatus status;

        objectpath = newCMPIObjectPath("root/interop", "CIM_IndicationHandlerCIMXML", NULL);
        CMAddKey(objectpath, "CreationClassName", "CIM_IndicationHandlerCIMXML", CMPI_chars);
        CMAddKey(objectpath, "SystemName", "localhost", CMPI_chars);
        CMAddKey(objectpath, "SystemCreationClassName", "CIM_ComputerSystem", CMPI_chars);
        CMAddKey(objectpath, "Name", "hpshd", CMPI_chars);

        instance = newCMPIInstance(objectpath, NULL);
        CMSetProperty(instance, "Name", "hpshd", CMPI_chars);
        stringstream ss;
        ss << "http://localhost:" << portNumber;
        CMSetProperty(instance, "Destination", ss.str().c_str(), CMPI_chars);

        objectpath2 = pclient->ft->createInstance(pclient, objectpath, instance, &status);
        handlerPath = objectpath2;

        logger.info("createInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        if(status.rc == 11)
        {
                status = pclient->ft->deleteInstance(pclient, objectpath);
                logger.info("deleteInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        }
        //if (instance) CMRelease(instance);
        //if (objectpath) CMRelease(objectpath);
        //if (status.msg) CMRelease(status.msg);
        logger.info("exit createHandler");
}

void SfcbClient::createSubscription()
{
        createFilter();
        createHandler();
        logger.info("enter createSubscription");
        CMPIObjectPath * objectpath, * objectpath2;
        CMPIInstance * instance;
        CMPIStatus status;

        objectpath = newCMPIObjectPath("root/interop", "CIM_IndicationSubscription", &status);
        CMPIValue value;
        value.ref = filterPath;
        CMAddKey(objectpath, "Filter", &value, CMPI_ref);

        value.ref = handlerPath;
        CMAddKey(objectpath, "Handler", &value, CMPI_ref);
        //CMAddKey(objectpath, "Filter", filterPath, CMPI_ref);
        //CMAddKey(objectpath, "Handler", handlerPath, CMPI_ref);

        logger.info("newCMPIObjectPath() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        instance = newCMPIInstance(objectpath, &status);
#if 1
        value.uint16 = 2;
        CMSetProperty(instance, "OnFatalErrorPolicy", &value, CMPI_uint16);

        value.uint16 = 2;
        CMSetProperty(instance, "SubscriptionState", &value, CMPI_uint16);

        value.uint16 = 2;
        CMSetProperty(instance, "RepeatNotificationPolicy", &value, CMPI_uint16);
#endif
#if 0
        value.ref = filterPath;
        CMSetProperty(instance, "Filter", &value, CMPI_ref);
        value.ref = handlerPath;
      CMSetProperty(instance, "Handler", &value, CMPI_ref);
#endif
//        CMSetProperty(instance, "Filter", filterPath, CMPI_ref);
 //     CMSetProperty(instance, "Handler", handlerPath, CMPI_ref);
        logger.info("newCMPIInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);

        objectpath2 = pclient->ft->createInstance(pclient, objectpath, instance, &status);
        CMRelease(objectpath);
        objectpath = objectpath2;

        logger.info("createInstance() rc=%d, msg=%s\n", status.rc, (status.msg)? (char *)status.msg->hdl : NULL);
        if (instance) CMRelease(instance);
        if (objectpath) CMRelease(objectpath);
        if (status.msg) CMRelease(status.msg);
        logger.info("exit createSubscription");

}