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:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"
  xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
    <s:Header>
        <a:To>http://server:80/wsman</a:To>
        <w:ResourceURI s:mustUnderstand="true">
http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process
        </w:ResourceURI>
        <a:ReplyTo>
            <a:Address s:mustUnderstand="true">
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
            </a:Address>
        </a:ReplyTo>
        <a:Action s:mustUnderstand="true">
http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process/Create
        </a:Action>
        <w:MaxEnvelopeSize s:mustUnderstand="true">
          51200
        </w:MaxEnvelopeSize>
        <a:MessageID>
          uuid:9A989269-283B-4624-BAC5-BC291F72E854
        </a:MessageID>
        <w:OperationTimeout>PT60.000S</w: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:a="http://schemas.xmlsoap.org/ws/2004/08/addressing"
  xmlns:w="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
    <s:Header>
        <a:Action s:mustUnderstand="true">
http://schemas.microsoft.com/wbem/wsman/1/wmi/root/cimv2/Win32_Process/CreateResponse
        </a:Action>
        <a:MessageID s:mustUnderstand="true">
          uuid:F0228E67-F37B-4BE3-BAA2-3BB58AA6F911
        </a:MessageID>
        <a:To>
http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
        </a:To>
        <a:RelatesTo s:mustUnderstand="true">
          uuid:9A989269-283B-4624-BAC5-BC291F72E854
        </a: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>
Page view tracker