Quantcast

OpenWsmanClient (CPP) - need help

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

OpenWsmanClient (CPP) - need help

Jason Miesionczek
I am working on an application to communicate with Hyper-V running on Windows Server 2008.

Here is the sample code I am trying to run:

auto client = new WsmanClientNamespace::OpenWsmanClient(
        connection->getHost(),
        5985,
        "/wsman",
        "http",
        "basic",
        connection->getUsername(),
        connection->getPassword()
        );
    client->SetNamespace("http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*");
    auto id = client->Identify();
    std::cout << id << std::endl;
    vector<std::string> result;
    WsmanClientNamespace::WsmanOptions *options = new WsmanClientNamespace::WsmanOptions();
    options->setNamespace("http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/*");
    WsmanClientNamespace::WsmanFilter* filter = new WsmanClientNamespace::WsmanFilter(WSM_WQL_FILTER_DIALECT, "select * from Win32_OperatingSystem ");
   
    client->Enumerate(
        "http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_OperatingSystem", result, *options, *filter);

The Identify call works fine. The Enumerate however, throws this SOAP fault:

terminate called after throwing an instance of 'WsmanClientNamespace::WsmanSoapFault'
  what():  A Soap Fault was received:
FaultCode: s:Receiver
FaultSubCode: w:InternalError
FaultReason: The WS-Management service cannot process the request. The resource URI and __cimnamespace selector attempted to use different namespaces. Try removing the __cimnamespace selector or using a DMTF resource URI. If a non-DMTF resource URI is used with a __cimnamespace selector, the namespaces must match.
FaultDetail: The WS-Management service cannot process the request. The resource URI and __cimnamespace selector attempted to use different namespaces. Try removing the __cimnamespace selector or using a DMTF resource URI. If a non-DMTF resource URI is used with a __cimnamespace selector, the namespaces must match.
HttpCode:  = 500

Anyone know what is going on?

Thanks,
Jason

------------------------------------------------------------------------------

_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: OpenWsmanClient (CPP) - need help

Klaus Kaempf
* Jason Miesionczek <[hidden email]> [Nov 22. 2016 23:10]:
>
>     client->Enumerate(
>         "
> http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_OperatingSystem",
                                                ^^^^^^^^^^
                                                This doesn't match
with the "Win32_" class schema.

/root/cimv2 is the namespace for "CIM_" Classes, just use
http://schemas.microsoft.com/wbem/wsman/1/wmi for 'Win32' classes.

Hth,

Klaus
--
SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg)

------------------------------------------------------------------------------
_______________________________________________
Openwsman-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/openwsman-devel
Loading...