private Map < String , String > receiveCommandResult ( HttpClientService csHttpClient , HttpClientInputs httpClientInputs , String shellId , String commandId , WSManRequestInputs wsManRequestInputs ) throws RuntimeException , IOException , URISyntaxException , TransformerException , TimeoutException , XPathExpressionException , SAXException , ParserConfigurationException , InterruptedException { String documentStr = ResourceLoader . loadAsString ( RECEIVE_REQUEST_XML ) ; documentStr = createReceiveRequestBody ( documentStr , httpClientInputs . getUrl ( ) , shellId , commandId , String . valueOf ( wsManRequestInputs . getMaxEnvelopeSize ( ) ) , wsManRequestInputs . getWinrmLocale ( ) , String . valueOf ( wsManRequestInputs . getOperationTimeout ( ) ) ) ; Map < String , String > receiveResult ; while ( true ) { receiveResult = executeRequestWithBody ( csHttpClient , httpClientInputs , documentStr ) ; if ( executionIsTimedOut ( commandExecutionStartTime , wsManRequestInputs . getOperationTimeout ( ) ) ) { throw new TimeoutException ( EXECUTION_TIMED_OUT ) ; } else if ( WSManUtils . isSpecificResponseAction ( receiveResult . get ( RETURN_RESULT ) , RECEIVE_RESPONSE_ACTION ) && WSManUtils . commandExecutionIsDone ( receiveResult . get ( RETURN_RESULT ) ) ) { return processCommandExecutionResponse ( receiveResult ) ; } else if ( WSManUtils . isFaultResponse ( receiveResult . get ( RETURN_RESULT ) ) ) { throw new RuntimeException ( WSManUtils . getResponseFault ( receiveResult . get ( RETURN_RESULT ) ) ) ; } try { Thread . sleep ( 200 ) ; } catch ( InterruptedException e ) { throw e ; } } }
Waits for a specific command that is running on a remote shell to finnish it s execution .