4.7.3 Receive Output

This example shows how to receive the prompt via the stdout stream from the Del command in the previous example, as defined in section 4.7.2. It also receives error results through the stderr stream if the remote command fails.

Receive 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://localhost:80/wsman
     </wsa:To>
     <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/windows/shell/Receive
     </wsa:Action>
     <wsman:MaxEnvelopeSize s:mustUnderstand="true">
       153600
     </wsman:MaxEnvelopeSize>
     <wsa:MessageID>uuid:D384DEF8-351E-41F0-B3DA-C91BE1A58A09</wsa:MessageID>
     <wsman:Locale xml:lang="en-US" s:mustUnderstand="false" />
     <wsman:ResourceURI 
       xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
       http://schemas.microsoft.com/wbem/wsman/1/windows/shell/cmd
     </wsman:ResourceURI>
     <wsman:SelectorSet 
       xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd"
       xmlns="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd">
       <wsman:Selector Name="ShellId">
         uuid:0A442A7F-4627-43AE-8751-900B509F0A1F
       </wsman:Selector>
     </wsman:SelectorSet>
     <wsman:OperationTimeout>PT60.000S</wsman:OperationTimeout>
   </s:Header>
   <s:Body>
     <rsp:Receive 
       xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"
       SequenceId="0">
       <rsp:DesiredStream CommandId="77df7bb6-b5a0-4777-abd9-9823c0774074">
         stdout stderr
       </rsp:DesiredStream>
     </rsp:Receive>
     </s:Body>
 </s:Envelope>
            

Receive 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> 
 http://schemas.microsoft.com/wbem/wsman/1/windows/shell/ReceiveResponse
     </wsa:Action>
     <wsa:MessageID>
         uuid:36B5315E-6592-4512-957E-038F14C27C83</wsa:MessageID>
     <wsa:To>
           http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous
     </wsa:To>
     <wsa:RelatesTo>uuid:D384DEF8-351E-41F0-B3DA-C91BE1A58A09</wsa:RelatesTo>
   </s:Header>
   <s:Body>
     <rsp:ReceiveResponse
       xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"
       SequenceId="0">
       <rsp:Stream
         xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"
         Name="stdout"
         CommandId="77df7bb6-b5a0-4777-abd9-9823c0774074">
         ZDpcdGVtcFxvdXQudHh0LCBEZWxldGUgKFkvTik/IA==
       </rsp:Stream>
       <rsp:CommandState
         xmlns:rsp="http://schemas.microsoft.com/wbem/wsman/1/windows/shell"
 State="http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Running" CommandId="77df7bb6-b5a0-4777-abd9-9823c0774074">
         <rsp:ExitCode>0</rsp:ExitCode>
       </rsp:CommandState>
       </rsp:ReceiveResponse>
   </s:Body>
 </s:Envelope>