4.1.4 Invoking a Method
The WS-Management Protocol can be used to invoke a method on a CIM class or instance. Win32_Process is a CIM class derived from CIM_Process, which has a method called Create that is used to create a process.
Invoke Method Request
-
<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/cimv2/Win32_Process </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.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process/Create </wsa:Action> <wsman:MaxEnvelopeSize s:mustUnderstand="true"> 51200 </wsman:MaxEnvelopeSize> <wsa:MessageID> uuid:9A989269-283B-4624-BAC5-BC291F72E854 </wsa:MessageID> <wsman:OperationTimeout>PT60.000S</wsman:OperationTimeout> </s:Header> <s:Body> <p:Create_INPUT xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cim/Win32_Process" > <p:CommandLine>notepad.exe</p:CommandLine> <p:CurrentDirectory>C:\</p:CurrentDirectory> </p:Create_INPUT> </s:Body> </s:Envelope>
Invoke Method 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.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process/CreateResponse </wsa:Action> <wsa:MessageID s:mustUnderstand="true"> uuid:F0228E67-F37B-4BE3-BAA2-3BB58AA6F911 </wsa:MessageID> <wsa:To> http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous </wsa:To> <wsa:RelatesTo s:mustUnderstand="true"> uuid:9A989269-283B-4624-BAC5-BC291F72E854 </wsa:RelatesTo> </s:Header> <s:Body> <p:Create_OUTPUT xmlns:p="http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process" > <p:ProcessId>4000</p:ProcessId> <p:ReturnValue>0</p:ReturnValue> </p:Create_OUTPUT> </s:Body> </s:Envelope>