From: Mike <bi...@ya...> - 2007-10-08 01:15:41
|
Bart, Thanks for the response. For the HTTPS requests, I think the exception was caused by a bug in the OpenWbem code. It incorrectly assumes that the app can write to and create the file ¡§C:/.rnd¡¨; But for my windows system, only System Admin can write to C:\; but when OpenWBEM fails to create a file handle on c:\, it just crashed. A better solution is to just create the file ¡§.rnd¡¨ on %HOMEPATH% (rather than c:\). For the properpty filtering, I still haven¡¦t figured out why I am still getting unknow exception(actually OpenWBEM API crashes with ¡§access violation¡¨). Here is my code sampe: StringArray myPropertyList; myPropertyList.append("Name"); CIMOMHandleIFCRef ch = ClientCIMOMHandle::createFromURL("http://user:pwd@localhost:5988/root/pg_interop"); CIMInstanceEnumeration enu = ch->enumInstancesE("root/pg_interop", "CIM_namespace", WBEMFlags::E_DEEP, WBEMFlags::E_NOT_LOCAL_ONLY, WBEMFlags::E_EXCLUDE_QUALIFIERS, WBEMFlags::E_EXCLUDE_CLASS_ORIGIN, &myPropertyList);//OpenWBEM crashes here with ¡§access violation Any ideas or other suggestions? Regards, -Mike Bart Whiteley <ba...@wh...> wrote: On 10/4/07, Mike <bi...@ya...> wrote: Hello Everyone, I was trying to use OpenWBEM CIMclient to make a connection over HTTPS; but I got an unknown exception. Here is my code sample: try { CIMClient securedClient(" https://user:passwd@localhost:5989/cimom" , "root/pg_interop"); securedClient.getClass(...); /// print the result } catch (const CIMException& e) { //print CIM exception } catch (...) { // print "Unknown Exception"; } Did I miss anything? Or how should I make a HTTPS connection to a CIMOM? By the way, I was also able to use Pegasus CIM CLI to connect via HTTPS on port 5989. So I guest I must miss something. Help or suggestions are greatly appreciated. By the way, does anyone know any good examples on how to use OpenWbem CIMClient, specicially the CIM Client APIs with the proprerty filtering? For example, how to tell the CIMClient to filer out all the properties exception "name" for CIM_System of enumInstancesE() without causing a unknown exception? Try this: #include <openwbem/OW_ClientCIMOMHandle.hpp> #include <openwbem/OW_CIMInstance.hpp> #include <openwbem/OW_CIMInstanceEnumeration.hpp> #include <openwbem/OW_CIMValue.hpp> #include <iostream> using namespace OpenWBEM; int main() { CIMOMHandleIFCRef ch = ClientCIMOMHandle::createFromURL(" https://root:secret@localhost/root/cimv2"); StringArray propertyList; propertyList.append("Name"); CIMInstanceEnumeration enu = ch->enumInstancesE("/root/cimv2", "CIM_System", WBEMFlags::E_DEEP, WBEMFlags::E_NOT_LOCAL_ONLY, WBEMFlags::E_EXCLUDE_QUALIFIERS, WBEMFlags::E_EXCLUDE_CLASS_ORIGIN, &propertyList); while(enu.hasMoreElements ()) { CIMInstance inst = enu.nextElement(); CIMValue cv = inst.getPropertyValue("Name"); String name; cv.get(name); std::cout << name << std::endl; } } --------------------------------- Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. |