4.1.1 Retrieving a CIM Instance
This section illustrates an example of a simple CIM class being accessed via the WS-Management Protocol.
Managed Object Format (MOF) representation of the class is specified in [DMTF-DSP0004].
-
[abstract] class Base { [key]sint32 id; }; class MyClass : Base { string Data1; }; instance of MyClass { id = 1; Data1 = "Hello World"; };
This is a simple CIM class hierarchy of two classes: a base CIM class and a derived CIM class called MyClass. These classes are defined in the CIM namespace called root\mycimnamespace.
To access an instance of this class by using a Get operation, the request is as follows.
-
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:To>http://server:80/wsman</wsa:To> <wsman:ResourceURI s:mustUnderstand="true"> http://schemas.microsoft.com/wbem/wsman/1/wmi/root/mynamespace/myclass </wsman:ResourceURI> <wsa:ReplyTo> <wsa:Address s:mustUnderstand="true"> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:Address> </wsa:ReplyTo> <wsa:Action s:mustUnderstand="true"> http://schemas.xmlsoap.org/ws/2004/09/transfer/Get </wsa:Action> <wsman:MaxEnvelopeSize s:mustUnderstand="true"> 51200 </wsman:MaxEnvelopeSize> <wsa:MessageID> uuid:5E6FD101-710A-4EEA-A50D-70C0BF863AA3 </wsa:MessageID> <wsman:SelectorSet> <wsman:Selector Name="id">1</wsman:Selector> </wsman:SelectorSet> <wsman:OperationTimeout>PT60.000S</wsman:OperationTimeout> </s:Header> <s:Body/> </s:Envelope>
Get Response
-
<s:Envelope xml:lang="en-US" xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <s:Header> <wsa:Action s:mustUnderstand="true"> http://schemas.xmlsoap.org/ws/2004/09/transfer/GetResponse </wsa:Action> <wsa:MessageID s:mustUnderstand="true"> uuid:2DAB718A-0103-4E0A-AB17-06C8A5530D2B </wsa:MessageID> <wsa:To> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:To> <wsa:RelatesTo s:mustUnderstand="true"> uuid:5E6FD101-710A-4EEA-A50D-70C0BF863AA3 </wsa:RelatesTo> </s:Header> <s:Body> <p:myclass xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/mynamespace/myclass" > <p:Data1>Hello World</p:Data1> <p:id>1</p:id> <cim:Location xmlns:cim="http://schemas.dmtf.org/wbem/wscim/1/common" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"> <wsa:Address> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:Address> <wsa:ReferenceParameters> <wsman:ResourceURI> http://schemas.microsoft.com/wbem/wsman/1/wmi/root/mynamespace/myclass </wsman:ResourceURI> <wsman:SelectorSet> <wsman:Selector Name="id">1</wsman:Selector> </wsman:SelectorSet> </wsa:ReferenceParameters> </cim:Location> </p:myclass> </s:Body> </s:Envelope>